jsreport Online with SQL Server



  • I successfully convinced my client to migrate from a self-hosted instance of jsreport to the cloud-based jsreport Online. This change was necessary as we're moving from a Ubuntu VM to Azure App Service, which doesn’t support self-hosted jsreport. However, after exporting all our reports and importing them into jsreport Online, we encountered errors due to the use of the mssql npm package. Is this package not supported in jsreport Online? We have tons of reports and all of them rely on connecting to SQL Server, which provides the JSON. I just assumed it was as flexible as the self-hosted version. Is there any way to connect to SQL Server and access the report data from jsreport Online?

    Thanks,
    Chris



  • What exact errors or problems do you encounter? Please elaborate...
    You should be able to install mssl npm package using jsreport npm extension also in jsreportonline
    https://jsreport.net/learn/npm

    Note the jsreport should also work in the Azure App Service
    https://jsreport.net/learn/azure-web-apps



  • Thanks! That worked. I'm glad I asked because ChatGPT and Copilot were saying it wasn't possible.
    I replaced:
    const sql = require('mssql');
    With:
    const jsreport = require('jsreport-proxy');
    const sql = await jsreport.npm.require('mssql@latest');



  • Is it possible or advisable to add those two require lines to some global file that each of the report script files reference? Would it help at all with performance?



  • I think it won't help.

    What could decrease the cost of the require call is adding config

    {
      "sandbox": { "isolateModules": false }
    }
    


  • Where is the config file located for jsreport Online?



  • Ah, sorry, I missed that this is related to jsreportonline. The config updates are not possible in jsreportonline, unfortunately.

    The problem is the time it takes to require the mssql module? These calls take typically just some milliseconds. The jsreport.npm.require will need to install module for the first time what may take some seconds, but the following require should be fast enough.



  • I'm not sure what the performance issue is. It times out. Wasn't like that when we were still running a local instance of jsreport. We're still on the free tier until I can prove it works just as well as the local instance. Will we see a significant performance increase when we switch to the paid version? Could this timeout be related to the jsreport.npm.require?
    0_1749758407667_upload-793f09f7-afb2-49ce-a673-5790f4cea0b3



  • Will we see a significant performance increase when we switch to the paid version?

    No, the containers are the same.

    Could this timeout be related to the jsreport.npm.require?

    Yes, this signals that the npm install of the module timed out.
    This can be some kind of transient network/npm error.
    It seems to work fine for me also in your account, please try later again.



  • Thanks, it's working today. Hopefully this is an issue that doesn't happen often.
    Another question, for the credits, what makes up one credit unit and do they replenish on the 1st of the month?



  • One credit is 1 second spent in the container that is processing your request. It is calculated based on milliseconds.
    It is replanishing based on your renewal date. Check the "created on" field in the settings of your profile.
    The studio browser requests are free of charge so you are free to play with your worskspace as much as needed.


Log in to reply
 

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