Orders sample report fails on local install

  • Hi,

    New user here.
    On a fresh local install of the latest (2.1.1) jsreport using download/install instructions, the Orders sample is failing with this error:

    SyntaxError: Unexpected end of JSON input
        at JSON.parse (<anonymous>)
        at Proxy.result.on (evaluate-user-script.js:15:49)
        at Object.apply (/Users/ilya/dev/waplanner/jsreportapp/node_modules/vm2/lib/contextify.js:87:36)
        at emitNone (events.js:111:20)
        at IncomingMessage.emit (events.js:208:7)
        at endReadableNT (_stream_readable.js:1056:12)
        at _combinedTickCallback (internal/process/next_tick.js:138:11)
        at process._tickDomainCallback (internal/process/next_tick.js:218:9)

    The other sample reports are working. It's also working in the playground.
    This is both on Mac OS and Linux, Node 8.9.3 and 8.10.0.

    Any ideas ...?

  • The external API used in this example has changed. We will have to reflect it and release a hotfix.

    Here is the fixed version of the script which you can use for now

  • Thanks for the fix, the JSON error is gone.
    However I'm running into another error:

    Error while executing user script. require of "http" module has been blocked. 
    To be able to require custom modules you need to add to configuration { "allowLocalFilesAccess": true } or enable just specific module using { "extensions": { "scripts": { "allowedModules": ["https"] } }.

    "allowLocalFilesAccess" is enabled by default, so shouldn't it be working out of the box ? I've also tried to add "https" option in "allowedModules" in the jsreport.config.json file (and restarting the server), but the error remains.

    What am I missing ?

  • Do you have this in the config file?

    "allowLocalFilesAccess": true

    Are you sure the config file is applied? You should see this line in the first lines of jsreport output.

    2018-08-15T14:15:19.880Z - info: Initializing jsreport@2.1.1 in production mode using configuration file: jsreport.config.json

  • config file:

      "extensions": {
        "authentication": {
          "cookieSession": {
            "secret": "<your strong secret here>"
          "admin": {
            "username": "admin",
            "password": "password"
          "enabled": false
        "scripts": {
          "timeout": 40000,
          "strategy": "http-server",
          "allowedModules": ["http","https"]
        "sample-template": {
          "createSamples": true
      "httpPort": 5488,
      "store": {
        "provider": "fs"
      "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,
      "templatingEngines": {
        "timeout": 10000,
        "strategy": "http-server"
      "chrome": {
        "timeout": 40000


    2018-08-15T15:09:20.189Z - info: Initializing jsreport@2.1.1 in development mode using configuration file: jsreport.config.json

  • OK, it's working now. I messed the script trying http instead of https and then forgot to restart the server.
    It's also working with the default config (without the "allowedModules" line).
    Thanks for your fast replies.

Log in to reply

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