Generating PDF/HTML with jsreport server and saved templates
-
I'm using jsreport to render reports in web application. The templates for the reports are saved in a database, the templates along with the report data is sent to jsreport studio via axios request.
The problem is that whenever I update the templates in my database, the updates does not reflect the rendering. Instead of rendering the updated templates, i still render the old version.
I have ensured that I was sending the correct template to the server, and I added version checks on the templates to ensure I had the right version before sending it to the server, I checked old forum posts and it looked like it could have been a cache problem so I disabled that, but it did not change anything. The only time the template updated was when I changed my configuration and had to remake the server.
my axios request goes something like this:
const response = await axios({
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/pdf'
},
url: JSREPORT_URL,
data: requestData,
maxBodyLength: Infinity,
responseType: 'arraybuffer',
timeout: 240000
});Do you possible have any other solution to this problem?
Thanks in advance for your help
-
What kind of database do you save data in? What jsreport template store driver do you use?
Technically, sql (PostgreSQL, MSSQL, Oracle) or MongoDB doesn't use any kind of cache for stored templates. This just can't happen. The file system based driver, including aws S3 and azure blob storage, cache the stored templates and this can happen.
-
The templates are saved in ArangoDB and deployed in an aws ec2 instance
-
jsreport doesn't have a driver for ArangoDB, so how do you configure jsreport and persist templates?
Here are the docs for jsreport templates store drivers
https://jsreport.net/learn/template-stores
-
Sorry let me clarify:
viewing, storing and altering of the template are done through queries to Arango in my app, i only use studios to render them.The rendering request is part of a component in my webapp, i get the report and template data via another API requests and queries sent to database. After gathering all the data, only then is a request is sent to studios to render it.
-
Ok, I see. So you don't persist templates in the jsreport. Instead, you send anonymous templates to the report API, which includes the content and helpers.
Hm. It shouldn't happen that you get a response based on an older request. Likely, there is something wrong on your end.
Try to enable full profiling and check what is really the input and output at the jsreport side.