Update to V3 broke all our templates



  • Hello,
    I'm trying to experiment with the docker image containing jsreport 3.0.1 and I'm facing a lot of issue on migrating the templates to the new version.

    require('request') is not working anymore and trigger a ModuleNotFound exception. We were not using any extra module since request was already included but I guess that the solution may be using axios and adding the following on the config.

    "scripts": {
         "allowedModules": ["handlebars", "request", "axios", "form-data"]
    }
    

    Second, the all the translations are broken. In the migration guide I read
    The v3 includes automatic migration for the templates using resources. It copies the linked resources into assets and attaches jsreport script which implementation replicates the same behavior as the resources extension provided in the v2. In other words, you can just upgrade jsreport and your current template using resources will work the same.
    but I cannot managed to execute this migration.
    The problem, even with a migration in place, is that part of the code made some assumption that are not valid anymore.
    For instance, is not possible to retrieve arrays anymore from the template. A possible solution I found is to use the localization function in the script and retrieve the array from there, but I noticed that the "folder" parameter is always relative to the template folder. This means that I have a template that merge multiple templates in one but I need to call the function with different folders, and this complicates the management of the translation.

    Third, I'm having issues with timeouts when using pdfutils to merge the results. The same code on v2 was working perfectly.

    What can I do from here?

    Thank you,
    Matteo



  • Little correction: request is now working correctly. I forgot, when running the image locally, to include the package as we did in the version we have currently in production. Sorry for the inconvenience.



  • I appologize for the inconvenience.
    Would you be able to email me the v2 workspace so I can take a look?
    jan.blaha@jsreport.net


Log in to reply
 

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