I've tried to replicate the issue with the following setup.
jsreport.config.json
{
"trustUserCode": true,
"tempDirectory": "/app/tmp"
}
Dockerfile
FROM jsreport/jsreport:3.13.0
RUN npm i client-oauth2@4.3.3 --save --save-exact
COPY --chown=jsreport:jsreport jsreport.config.json /app
A template with html recipe and "Hello world" content with attached script
async function beforeRender (req, res) {
const jsreport = require("jsreport-proxy")
console.log(await jsreport.npm.require("client-oauth2@4.3.3"))
}
Then I run a load test with the following code, which results in 0 errors.
const client = require('@jsreport/nodejs-client')('http://localhost:5488')
function runOne () {
return client.render({
template: {
name: 'test'
}
})
}
async function runMany () {
for (let i = 0; i < 1000; i++) {
await Promise.all([runOne(), runOne(), runOne(), runOne(), runOne()])
console.log(i * 5)
}
}
runMany().then(() => console.log('done')).catch(console.error)
Could you try to replicate the error in a simple way like this?
Note that when the dependency is installed in the image, you don't need to use the jsreport.npm.require. You can call simply the require('client-oauth2')