node-html-to-image
node-html-to-image copied to clipboard
Heroku problem on Deploy
I have a problem with Node HTML to Image, basically I'm retrieved the log:
2022-07-10T01:30:20.612661+00:00 app[web.1]: Available on: http://localhost:3000
2022-07-10T01:30:21.036249+00:00 heroku[web.1]: State changed from starting to up
2022-07-10T01:30:54.450976+00:00 app[web.1]: /app/node_modules/puppeteer-cluster/dist/Cluster.js:119
2022-07-10T01:30:54.450996+00:00 app[web.1]: throw new Error(Unable to launch browser, error message: ${err.message});
2022-07-10T01:30:54.450997+00:00 app[web.1]: ^
2022-07-10T01:30:54.450998+00:00 app[web.1]:
2022-07-10T01:30:54.450998+00:00 app[web.1]: Error: Unable to launch browser, error message: Failed to launch the browser process!
2022-07-10T01:30:54.450999+00:00 app[web.1]: [0710/013053.411822:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
2022-07-10T01:30:54.450999+00:00 app[web.1]: #0 0x55d93a2cbb89 base::debug::CollectStackTrace()
2022-07-10T01:30:54.451000+00:00 app[web.1]: #1 0x55d93a230433 base::debug::StackTrace::StackTrace()
2022-07-10T01:30:54.451000+00:00 app[web.1]: #2 0x55d93a243330 logging::LogMessage::~LogMessage()
2022-07-10T01:30:54.451000+00:00 app[web.1]: #3 0x55d93822899b content::ZygoteHostImpl::Init()
2022-07-10T01:30:54.451001+00:00 app[web.1]: #4 0x55d939dd9372 content::ContentMainRunnerImpl::Initialize()
2022-07-10T01:30:54.451002+00:00 app[web.1]: #5 0x55d939dd7439 content::RunContentProcess()
2022-07-10T01:30:54.451002+00:00 app[web.1]: #6 0x55d939dd758e content::ContentMain()
2022-07-10T01:30:54.451003+00:00 app[web.1]: #7 0x55d939e32d7a headless::(anonymous namespace)::RunContentMain()
2022-07-10T01:30:54.451003+00:00 app[web.1]: #8 0x55d939e32a85 headless::HeadlessShellMain()
2022-07-10T01:30:54.451003+00:00 app[web.1]: #9 0x55d9368963e8 ChromeMain
2022-07-10T01:30:54.451004+00:00 app[web.1]: #10 0x7fd90ec3f083 __libc_start_main
2022-07-10T01:30:54.451004+00:00 app[web.1]: #11 0x55d93689622a _start
2022-07-10T01:30:54.451004+00:00 app[web.1]:
2022-07-10T01:30:54.451004+00:00 app[web.1]:
2022-07-10T01:30:54.451005+00:00 app[web.1]:
2022-07-10T01:30:54.451005+00:00 app[web.1]: TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2022-07-10T01:30:54.451005+00:00 app[web.1]:
2022-07-10T01:30:54.451005+00:00 app[web.1]: at Cluster.
I try using puppeteer-heroku-buildpack but don't resolve my problem. Do you have any light?
You can run the conversion while including a puppeteerArgs option with the --no-sandbox flag, like so:
{
html,
puppeteerArgs: {
args: ['--no-sandbox']
}
}
I had a substantially similar issue (the logs look familiar, don't know how to dig back through the Heroku logs that far to find the original error), but I was able to resolve it this way. The Troubleshooting docs are actually pretty good and had most of this in it, with the exception that you have to hunt through the docs for node-html-to-image to hopefully catch the puppeteerArgs thing.
Typescript definitely helps figure out what the exact syntax and data types are as well. I didn't even have the buildpack at first or I might not have looked there. The link was much more prominently placed in the "you don't have the buildpack" error message.
I just released 3.3.0 version which contain a feature to customise which puppeteer library node-html-to-image uses. It might help you making node-html-to-image work in a cloud context. Here is the documentation : https://github.com/frinyvonnick/node-html-to-image#using-different-puppeteer-libraries
Could you close the issue if it fixes it, please?
Without any new answer I close this issue. Feels free to reopen it 👍