jsreport.renderAsync({
template: {
shortid: reportalObj[i].js_short_id
},
data: payload,
options: {
reports: {
save: true,
blobName: name
}
}
})
.then(res => {
res.headers
})
results in undefined
access-control-allow-origin: *
access-control-expose-headers: *
connection: keep-alive
content-disposition: inline;filename=Maine Vernal Pool Assessment.pdf
content-type: application/pdf
date: Wed, 20 May 2020 20:58:10 GMT
server: nginx/1.14.0 (Ubuntu)
transfer-encoding: chunked
x-powered-by: Express
x-xss-protection: 0
this was reply from res.xhs.getAllResponseHeaders();
Hey Everyone, I am using JSreport for production and it is deployed in Heroku with 1x dyno
But app keep crashing when 11 concurrent requests are made. I am unable to figure out what is the root issue
I am using the default jsreport.config.json
{
"extensions": {
"httpPort": 5488,
"httpsPort": null,
"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,
"numberOfWorkers": 12,
"strategy": "http-server",
"templateCache": {
"max": 100,
"enabled": true
}
},
"chrome": {
"timeout": 40000,
"strategy": "chrome-pool",
"numberOfWorkers": 12,
"launchOptions": {
"args": [
"--no-sandbox"
]
}
}
}
hi @gauravprwl14
hmm the configuration file looks wrong, it should be more like this:
{
"httpPort": 5488,
"httpsPort": null,
"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,
"numberOfWorkers": 12,
"strategy": "http-server",
"templateCache": {
"max": 100,
"enabled": true
}
},
"extensions": {
"chrome": {
"timeout": 40000,
"strategy": "chrome-pool",
"numberOfWorkers": 12,
"launchOptions": {
"args": [
"--no-sandbox"
]
}
}
}
}
however i don’t know if this is the real file you are using or you just copied it wrong here
as per the 11 concurrent requests problem hmm i don’t have a good explanation, it will be really weird the jsreport produces this alone, i guess this is a problem with some configuration in Heroku, are there no logs available in the Heroku side?
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.387Z - debug: Base url not specified, skipping its injection.
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.403Z - debug: Replaced assets ["Helvetica.otf"]
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.405Z - debug: Rendering engine handlebars
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.414Z - debug: Replaced assets ["Helvetica.otf"]
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.417Z - debug: Rendering engine handlebars
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.429Z - debug: Replaced assets ["Helvetica.otf"]
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.430Z - debug: Rendering engine handlebars
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.565Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.570Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.699Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.708Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.711Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.724Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.794Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.796Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.797Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.798Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.798Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.800Z - debug: Compiled template not found in the cache, compiling
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.803Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.806Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.807Z - debug: Executing recipe chrome-pdf
May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.809Z - debug: Executing recipe chrome-pdf
May 25 04:01:11 airops-reporting-staging app/web.1 2020-05-25T11:01:11.202Z - debug: Converting with chrome HeadlessChrome/79.0.3945.0 using chrome-pool strategy
May 25 04:01:11 airops-reporting-staging app/web.1 2020-05-25T11:01:11.430Z - debug: Converting with chrome HeadlessChrome/79.0.3945.0 using chrome-pool strategy
May 25 04:01:11 airops-reporting-staging app/web.1 2020-05-25T11:01:11.486Z - debug: Converting with chrome HeadlessChrome/79.0.3945.0 using chrome-pool strategy
May 25 04:01:14 airops-reporting-staging app/web.1 #1 0x55e7300d3ee3 base::debug::StackTrace::StackTrace()
May 25 04:01:14 airops-reporting-staging app/web.1 #3 0x55e73014225f base::SimpleThread::Start()
May 25 04:01:14 airops-reporting-staging app/web.1 #4 0x55e72e910a72 content::SandboxHostLinux::Init()
May 25 04:01:14 airops-reporting-staging app/web.1 #8 0x55e72fd5a9dd headless::(anonymous namespace)::RunContentMain()
May 25 04:01:14 airops-reporting-staging app/web.1 #9 0x55e72fd5a73b headless::HeadlessShellMain()
May 25 04:01:14 airops-reporting-staging app/web.1 #12 0x55e72da1f0aa _start
May 25 04:01:14 airops-reporting-staging app/web.1 #0 0x55e73016fe29 base::debug::CollectStackTrace()
May 25 04:01:14 airops-reporting-staging app/web.1 #1 0x55e7300d3ee3
});
Engine.Handlebars
for the header merge operation
the string is
function getPageNumber (pageIndex) {
if (pageIndex == null) {
return ''
}
const pageNumber = pageIndex + 1
return pageNumber
}
function getTotalPages (pages) {
if (!pages) {
return ''
}
return pages.length
}
Hi... I am trying to access the $pdf object in my handlebars template so that I can write conditional logic for the PDF header based on the pageNumber..... but I am unable to manage to get the $pdf variable working... it probably seems to stay undefined... I tried different ways but I am not able to make it work... PLEASE SOMEONE KINDLY HELP ME..
more info: using jsreport-core https://github.com/jsreport/jsreport-core in nodejs