marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 545 forks source link

Throw error explicitly using the callback instead of failing due to "Cannot read property 'filename' of undefined" #643

Open omrilit opened 3 years ago

jagadeesh93 commented 2 years ago

@omrilit Hii , I am also facing the same issue on the version 3.0.1, Is there any fix for this , Thanks in advance

omrilit commented 2 years ago

@omrilit Hii , I am also facing the same issue on the version 3.0.1, Is there any fix for this , Thanks in advance

@jagadeesh93 not that I am aware of. I've just forked the repo and added this PR's content. You can see it at https://github.com/salto-io/node-html-pdf

barakplasma commented 2 years ago

I have a suspicion that this bug might be caused by phantomjs failing but html-pdf not catching it and counting on there being a file when there isn't one. PR 644 might solve this issue

barakplasma commented 2 years ago

For a patch in the meanwhile, see https://github.com/marcbachmann/node-html-pdf/pull/644#issuecomment-1032289083 . I'm going to rollout the patch in prod, ping me later if you're interested in whether it solved the issue for me.

omrilit commented 2 years ago

@barakplasma it would be great if you could write here if it worked for you.

barakplasma commented 2 years ago

I haven't deployed to prod yet, so no news. However, I did write a case to recreate this particular bug in my branch which shows that the fix in #644 does prevent the bug we are experiencing in this issue.

barakplasma commented 2 years ago

@omrilit your mileage may vary, but I deployed the fix in #644 to prod, and we haven't had that error since