Problem with nodemailer



  • Sorry for the new topic, I not sure why the jsreport unable to find "nodemailer" even though I already setup the [extensions_scripts_allowedModules] to [*]... "request" is working fine though, this is running on Azure webapp via docker hub.

    0_1568779104341_upload-9470fe3f-938c-4d8f-9f9f-0750695d6995

    0_1568779184502_upload-c849d214-9389-4e4e-83fb-bb0716f4391f



  • Do you use your custom docker image? Do you have nodemailer installed in it?
    Can you share your dockerfile?

    In case you use jsreport official image you need to additionally install nodemailer there.
    https://jsreport.net/learn/customize-docker-image



  • Oh i didnt not... i am using the one on docker hub....

    does the docker hub has that extension included?



  • nodemailer isn't jsreport extension but a custom npm module and it isn't included.
    https://www.npmjs.com/package/nodemailer



  • i see, is there any build in email extension come default with jsreport?

    If none, I shall try build the docker image with nodemailer

    thanks for the swift response



  • You need to install a custom module for a mail client.
    The other option is to use an email saas like sendgrid and just make an HTTP request to call its API when you want to send an email



  • Noted Jan Blaha, at least jsreport are flexible to do it, thanks!



  • Okay now i face another error, I following the guide and included the npm install the nodemailer, but i cant seems to get this fs-store going... I was referring back my web app configuration and change it to json.

    Error as such:
    Error when loading extension fs-store@2.4.1
    Error: options of extension fs-store contain values that does not match the defined schema. schema validation errors: options.persistence.provider should be equal to one of the allowed values. allowed values: ["fs"]
    at Object._useOne (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:145:19)
    at Object._useMany (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:93:20)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

    my json file as such:
    {
    "licenseKey": "pnc",
    "store": {
    "provider": "fs"
    },
    "extensions": {
    "authentication": {
    "cookieSession": {
    "secret": "pnc"
    },
    "admin": {
    "username": "admin",
    "password": "pnc"
    },
    "enabled": true
    },
    "scripts": {
    "timeout": 40000,
    "strategy": "http-server",
    "allowedModules": "true"
    },
    "sample-template": {
    "createSamples": true
    },
    "fs-store" : {
    "persistence": {
    "provider" : "azure-storage"
    }
    },
    "fs-store-azure-sb-sync" : {
    "conntectionString" : "pnc"
    },
    "fs-store-azure-storage-persistence" : {
    "accountKey" : "pnc",
    "accountName": "pnc"
    }
    },
    "httpPort": 5488,
    "blobStorage": {
    "provider": "fs"
    },
    "logger": {
    "console": {
    "transport": "console",
    "level": "debug"
    },
    "file": {
    "transport": "file",
    "level": "info",
    "filename": "logs/reporter.log"
    },
    "error": {
    "transport": "file",
    "level": "error",
    "filename": "logs/error.log"
    }
    },
    "allowLocalFilesAccess": true,
    "chrome": {
    "timeout": 1000000
    },
    "tasks": {
    "timeout": 900000
    },
    "templatingEngines" : {
    "timeout": 900000,
    "strategy": "http-server"
    }
    }



  • Hi anyone can help me with my json config for the docker image?



  • You probably don't have azure storage persistence extension installed or it fails at some point.

    Please follow the docs
    https://jsreport.net/learn/fs-store#azure-storage

    Share the output logs if it didn't help



  • Okay now I add that, i able to build and deploy but there's error message when running my script, it seems the extension still not installed via npm.
    Here's my script to build my docker:
    FROM jsreport/jsreport:2.5.0
    RUN npm i nodemailer -–save
    RUN npm i request --save
    RUN npm i jsreport-fs-store -–save
    RUN npm i jsreport-fs-store-azure-storage-persistence -–save
    COPY jsreport.config.json /app

    Error message during the build:
    npm WARN pdfjs-dist@2.0.489 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN worker-loader@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN jsreport-server@ No repository field.
    npm WARN jsreport-server@ No license field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    • nodemailer@6.3.0
      added 1 package from 1 contributor and audited 5062 packages in 5.064s
      found 66 high severity vulnerabilities
      run npm audit fix to fix them, or npm audit for details
      ---> 86f5c94b6d5a
      Removing intermediate container f935cf28b054
      Step 3/6 : RUN npm install request --save
      ---> Running in 11b8eabad9d8

    npm WARN pdfjs-dist@2.0.489 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN worker-loader@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN jsreport-server@ No repository field.
    npm WARN jsreport-server@ No license field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    • request@2.88.0
      updated 2 packages and audited 5125 packages in 5.667s
      found 66 high severity vulnerabilities
      run npm audit fix to fix them, or npm audit for details
      ---> b96c9c30c9f5
      Removing intermediate container 11b8eabad9d8
      Step 4/6 : RUN npm install jsreport-fs-store --save
      ---> Running in 18665c3f212b

    npm WARN pdfjs-dist@2.0.489 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN worker-loader@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN jsreport-server@ No repository field.
    npm WARN jsreport-server@ No license field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    • jsreport-fs-store@2.6.0
      added 12 packages from 16 contributors, updated 9 packages and audited 7344 packages in 8.002s

    found 99 high severity vulnerabilities
    run npm audit fix to fix them, or npm audit for details
    ---> 1060081b534c
    Removing intermediate container 18665c3f212b
    Step 5/6 : RUN npm install jsreport-fs-store-azure-storage-persistence --save
    ---> Running in ba2b6d3d3655

    npm WARN pdfjs-dist@2.0.489 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN worker-loader@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN jsreport-server@ No repository field.
    npm WARN jsreport-server@ No license field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    And here's message when i start my docker:
    [dockerpath]# docker run -p 5488:5488 --name jsreport myjsreport
    nologin: this account is not available
    2019-09-25T09:48:28.554Z - info: Initializing jsreport@2.5.0 in production mode using configuration file: jsreport.config.json
    2019-09-25T09:48:28.559Z - info: Searching for available extensions in /app/
    2019-09-25T09:48:28.566Z - info: Extensions location cache not found, crawling directories
    2019-09-25T09:48:28.794Z - info: Found 32 extensions
    2019-09-25T09:48:28.811Z - debug: Writing extension locations cache to /tmp/jsreport/core/locations.json
    2019-09-25T09:48:28.811Z - debug: Discovered 32 extensions
    2019-09-25T09:48:28.859Z - info: Setting http-server strategy for rendering
    2019-09-25T09:48:28.998Z - info: Using extension authentication@2.2.3
    2019-09-25T09:48:29.027Z - info: Using extension cli@2.0.7
    2019-09-25T09:48:29.029Z - info: Using extension debug@2.0.2
    2019-09-25T09:48:29.030Z - info: Using extension express@2.4.0
    2019-09-25T09:48:29.120Z - info: Using extension freeze@2.0.0
    2019-09-25T09:48:29.122Z - info: Using extension handlebars@2.0.2
    2019-09-25T09:48:29.123Z - info: Using extension import-export@1.3.0
    2019-09-25T09:48:29.229Z - info: Using extension jsrender@2.0.0
    2019-09-25T09:48:29.229Z - info: Using extension tags@2.2.0
    2019-09-25T09:48:29.231Z - info: Using extension templates@2.2.0
    2019-09-25T09:48:29.233Z - info: Using extension authorization@2.2.4
    2019-09-25T09:48:29.236Z - info: Using extension base@2.0.2
    2019-09-25T09:48:29.237Z - info: Using extension browser-client@2.1.1
    2019-09-25T09:48:29.239Z - info: Using extension child-templates@1.2.0
    2019-09-25T09:48:29.242Z - info: Using extension chrome-pdf@1.4.0
    2019-09-25T09:48:29.298Z - debug: Chrome strategy is dedicated-process
    2019-09-25T09:48:29.298Z - debug: Chrome custom launch options are executablePath=/usr/lib/chromium/chrome, args=[--no-sandbox]
    2019-09-25T09:48:29.299Z - info: Using extension data@2.1.0
    2019-09-25T09:48:29.300Z - info: Using extension fs-store@2.6.0
    2019-09-25T09:48:29.452Z - info: fs store underlying changes synchronization with studio is disabled
    2019-09-25T09:48:29.452Z - info: Using extension licensing@2.1.0
    2019-09-25T09:48:29.478Z - info: Using extension pdf-utils@1.4.0
    2019-09-25T09:48:29.607Z - info: Using extension reports@2.2.0
    2019-09-25T09:48:29.609Z - info: Using extension studio@2.5.1
    2019-09-25T09:48:29.618Z - debug: studio request logs are enabled (flush interval: 2000)
    2019-09-25T09:48:29.619Z - info: Using extension text@2.0.0
    2019-09-25T09:48:29.619Z - info: Using extension version-control@1.2.3
    2019-09-25T09:48:29.676Z - info: Using extension assets@1.1.3
    2019-09-25T09:48:29.681Z - info: Using extension fs-store-azure-storage-persistence@1.0.5
    2019-09-25T09:48:29.772Z - info: Using extension html-to-xlsx@2.3.1
    2019-09-25T09:48:29.869Z - info: html-to-xlsx detected chrome as available html engine
    2019-09-25T09:48:29.869Z - info: Using extension scheduling@2.0.7
    2019-09-25T09:48:29.907Z - info: Using extension scripts@2.1.0
    2019-09-25T09:48:29.912Z - info: Using extension xlsx@2.0.10
    2019-09-25T09:48:30.026Z - info: Using extension public-templates@2.0.1
    2019-09-25T09:48:30.027Z - info: Using extension resources@2.0.3
    2019-09-25T09:48:30.028Z - info: Using extension sample-template@2.3.0
    2019-09-25T09:48:30.030Z - info: Using fs provider for template store.
    2019-09-25T09:48:30.034Z - info: fs store is persisting using azure-storage
    2019-09-25T09:48:30.061Z - info: fs store is using no synchronization
    2019-09-25T09:48:30.137Z - info: fs store is loading data
    2019-09-25T09:48:32.361Z - info: fs store is initialized successfully
    2019-09-25T09:48:32.397Z - info: Creating default express app.
    2019-09-25T09:48:32.412Z - info: jsreport server successfully started on http port: 5488
    2019-09-25T09:48:32.413Z - debug: fs store sync modifications is disabled
    2019-09-25T09:48:32.415Z - info: Verifying license key censored
    2019-09-25T09:48:33.469Z - info: License key verified
    2019-09-25T09:48:33.470Z - info: Storing license verification information to jsreport.license.json
    2019-09-25T09:48:33.476Z - debug: Inserting samples
    2019-09-25T09:48:33.776Z - debug: Not creating samples because "samples" folder already exists
    2019-09-25T09:48:33.777Z - info: reporter initialized



  • did i do any wrong steps on my docker image build script? is there anyone had done it before mine share me the experience?

    *first timer doing docker image


  • administrators

    but there's error message when running my script

    the only error messages i can see in your last logs are npm warnings, but you can safely ignore them.. it is just printed some warnings about peer deps that should not affect your installation at all.

    it seems the extension still not installed via npm.

    is there something that makes you think that? i see in your logs this line 2019-09-25T09:48:30.034Z - info: fs store is persisting using azure-storage so it seems to me that it should be installed correctly and that jsreport is using it for entities persistence.



  • Okay it turns out it's really my jsreport config json fault, i added
    "templatingEngines" : {
    "strategy": "http-server",
    "allowedModules": "*"
    }
    then it works fine, hope people find this helpful in future.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.