jsreport-cli export error



  • Hi, I'm trying to create an export file as suggested in https://jsreport.net/learn/fs-store#deployment

    I want to do this in my build pipeline, and my approach is to take the latest jsreport docker image (3.0.1) and install jsreport-cli in it, copy my template files to the /app/data directory, and then run the export from the /app directory; however, I'm getting this error no matter what I try:

    /app # jsreport export /tmp/export-full.jsrexport
    A critical error occurred while trying to execute the export command: An error has occurred when trying to initialize jsreport (2). function Format(options = {}) {
        this.options = options;
      } could not be cloned. (1). 
    caused by error (2):
    -> meta = {"code":25}
    -> stack
    Error:
        at /app/node_modules/@jsreport/jsreport-cli/lib/instanceHandler.js:31:29
        at async exports.handler (/app/node_modules/@jsreport/jsreport-import-export/cli/export.js:155:5)
        at async Commander.executeCommand (/app/node_modules/@jsreport/jsreport-cli/lib/commander.js:244:22)
    caused by error (1):
    -> stack
    DataCloneError: function Format(options = {}) {
        this.options = options;
      } could not be cloned.
        at new Worker (node:internal/worker:235:17)
        at createWorker (/app/node_modules/@jsreport/advanced-workers/lib/workersManager.js:14:20)
        at createWorker (/app/node_modules/@jsreport/advanced-workers/lib/workersManager.js:33:29)
        at /app/node_modules/@jsreport/advanced-workers/lib/pool.js:15:26
        at /app/node_modules/@jsreport/advanced-workers/lib/pool.js:20:52
        at Array.map (<anonymous>)
        at Object.init (/app/node_modules/@jsreport/advanced-workers/lib/pool.js:20:42)
        at Object.init (/app/node_modules/@jsreport/advanced-workers/lib/workersManager.js:37:24)
        at MainReporter.init (/app/node_modules/@jsreport/jsreport-core/lib/main/reporter.js:255:34)
        at async exports.handler (/app/node_modules/@jsreport/jsreport-import-export/cli/export.js:155:5)
        at async Commander.executeCommand (/app/node_modules/@jsreport/jsreport-cli/lib/commander.js:244:22)
    

    I also tried initializing a separate directory using jsreport init and installing and exporting the templates from there, with the same result.

    What am I doing wrong? Thanks in advance!



  • Hi,

    the latest jsreport is 3.1.1 and this was fixed there.
    Could you update and try again?



  • I upgraded my jsreport image to 3.1.1, however, the latest version of jsreport-cli is still 2.2.5 as far as I can tell, and it still has the same problem.

    / # npm install -g @jsreport/jsreport-cli
    [...]
    / # npm view jsreport-cli version
    2.2.5
    

    There does not seem to be a preinstalled jsreport-cli tool on the image? Or is there a way to do this from the container shell without installing/using jsreport-cli?



  • I've found that in the jsreport:3.1.1 image, jsreport-cli is installed but not on the path, however, I'm still getting the same error with that:

    /app # /app/node_modules/@jsreport/jsreport-cli/cli.js --version
    jsreport version: 3.1.1
    cli version: 3.0.0
    /app # /app/node_modules/@jsreport/jsreport-cli/cli.js export export.jsrexport 
    A critical error occurred while trying to execute the export command: An error has occurred when trying to initialize jsreport (2). function Format(options = {}) {
        this.options = options;
      } could not be cloned. (1). 
    caused by error (2):
    -> meta = {"code":25}
    -> stack
    Error:
        at /app/node_modules/@jsreport/jsreport-cli/lib/instanceHandler.js:31:29
        at async exports.handler (/app/node_modules/@jsreport/jsreport-import-export/cli/export.js:155:5)
        at async Commander.executeCommand (/app/node_modules/@jsreport/jsreport-cli/lib/commander.js:244:22)
    caused by error (1):
    -> stack
    DataCloneError: function Format(options = {}) {
        this.options = options;
      } could not be cloned.
        at new Worker (node:internal/worker:235:17)
        at createWorker (/app/node_modules/@jsreport/advanced-workers/lib/workersManager.js:14:20)
        at createWorker (/app/node_modules/@jsreport/advanced-workers/lib/workersManager.js:33:29)
        at /app/node_modules/@jsreport/advanced-workers/lib/pool.js:15:26
        at /app/node_modules/@jsreport/advanced-workers/lib/pool.js:20:52
        at Array.map (<anonymous>)
        at Object.init (/app/node_modules/@jsreport/advanced-workers/lib/pool.js:20:42)
        at Object.init (/app/node_modules/@jsreport/advanced-workers/lib/workersManager.js:37:24)
        at MainReporter.init (/app/node_modules/@jsreport/jsreport-core/lib/main/reporter.js:256:34)
        at async exports.handler (/app/node_modules/@jsreport/jsreport-import-export/cli/export.js:155:5)
    


  • I appologize for the confusion, I thought it's fixed there but we have it just in the master branch and haven't released it yet. We plan to ship it the next week.

    I've found that in the jsreport:3.1.1 image, jsreport-cli is installed but not on the path

    Yes, there is no global jsreport-cli because we thought it isn't common to call it inside the container.
    We will discuss if it is better to have it there.



  • Thanks for your update!

    there is no global jsreport-cli because we thought it isn't common to call it inside the container.

    Frankly, I don't know whether it is common, I just need an image to run it on, and the jsreport image seemed like the obvious choice (we run all build steps in docker containers in our gitlab pipelines).

    So we'll wait for the next release, thanks.



  • Hi,
    I just tried the exact same thing with the jsreport:3.2.0 image, and I still get the same error (DataCloneError).
    Maybe it's still not fixed in the included CLI version?

    It works fine however with the windows "single executable" version.

    Have I missed something here?
    Thanks in advance.


  • administrators

    hi! it should be fixed on the 3.3.0 version and jsreport:3.3.0 image, which were released yesterday


Log in to reply
 

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