I was running into an issue when running this behind a webserver as a microservice. Basically the first request would generate the pdf as expected however subsequent requests were returning the same PDF. After some debugging I found that the HTML files are being written correctly but options isn't getting updated.
My change just uses lodash to do a deep clone of the the options passed in so that any modifications that are done are not passed on to subsequent request.
I was running into an issue when running this behind a webserver as a microservice. Basically the first request would generate the pdf as expected however subsequent requests were returning the same PDF. After some debugging I found that the HTML files are being written correctly but options isn't getting updated.
Here is the options on the first pass:
And on the second:
Notice that the url is already set to the previous HTML document. And based on this code:
It would reuse the same url over and over again.
My change just uses lodash to do a deep clone of the the options passed in so that any modifications that are done are not passed on to subsequent request.