Receive error when upgrading jsReport from v1.x to v2.x



  • My application is using jsReport with an existing Express app. I tried to upgrade it into version 2.1.0. Here are what I did:

    1. uninstall the current jsReport 1.9 (npm uninstall jsReport)
    2. install jsReport 2.1.0 (npm install jsReport)
    3. add a configuration file jsreport.config.json
    4. modify part of the script starting jsReport as:
        let jsreport = require('jsreport')({
            extensions: {
                express: { app: reportingApp, server: server },
            },
            appPath: "/reporting"
        });
    
        jsreport.init()
            .then(() => {
                console.log(`JSReport instance ${process.pid} started correctly.`);
            }).catch((e) => {
                console.error(e);
            });
    
        app.use('/reporting', reportingApp);
    

    After that, I ran my application and received the following error message:

    Process 16352 is listening to all incoming requests
    2018-06-20T22:52:17.710Z - error: Error occured during reporter init Error: options contain values that does not match the defined base root schema. schema validation errors: rootOptions.blobStorage should be object
        at Reporter.init (C:\CPMS\iroot-new\cpms-reporting\node_modules\jsreport-core\lib\reporter.js:106:15)
        at <anonymous>
        at process._tickDomainCallback (internal/process/next_tick.js:228:7)
    Error: options contain values that does not match the defined base root schema. schema validation errors: rootOptions.blobStorage should be object
        at Reporter.init (C:\CPMS\iroot-new\cpms-reporting\node_modules\jsreport-core\lib\reporter.js:106:15)
        at <anonymous>
        at process._tickDomainCallback (internal/process/next_tick.js:228:7)
    

    Did I miss anything?



  • Please share your config file. You have an issue in the blobStorage node. It should look like

    "blobStorage": {
            "provider": "fs"
    }
    

    This was changed in v2 among some other config chages

    https://jsreport.net/learn/v2-breaking-changes



  • @jan_blaha , the following is my jsreport.config.json:

    {"extensions": {
        "authentication": {
          "cookieSession": {
            "secret": "<your strong secret here>"
          },
          "admin": {
            "username": "admin",
            "password": "password"
          },
          "enabled": false
        },
        "scripts": {
          "timeout": 40000,
          "strategy": "http-server"
        },
        "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
      }
    }
    

    I still see error :-(



  • Hm. The same config/code works for me. Don't you have an environment variable blobStorage set?



  • Also you should see in the output jsreport is using your configuration file. Can you verify?

    2018-06-21T15:09:28.976Z - info: Initializing jsreport@2.1.0 in production mode using configuration file: jsreport.config.json
    


  • @jan_blaha You are right. My program is not using the right configuration file. It works after I removed the old dev.config.json and prod.config.json.

    Thank you very much!


Log in to reply
 

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