I would personally do it on another self hosted instance running prerender.com (the other service from prerender.io) or with a lambda function but in all cases, not on my Meteor server(s).
Were you able to get puppeteer to run on Galaxy?
Push
I successfully run an meteor app with puppeteer in heroku using this buildpack ( I have to use an old puppeteer version (3.0.0) because the size of the newer versions exeeds the maximum size (500mb) for heroku apps, but for PDF creation this is fairly sufficient)
Like @zayco stated meteor-up (mup) has the ability to attach buildInstructions, so the missing shared libraries can be installed that way. So the question is:
Is there a way to attach buildInstructions for shared libraries to a meteor deploy
at Galaxy?
Also interested in deploying an app on galaxy that uses puppeteer.
Hey everyone, I think the Meteor Galaxy team just made it VERY easy to now run a Docker base image with puppeteer . I need to try this out still, so if anyone beats me to it, please share how it worked for you here.
Just add the “baseImage” spec to you settings.json
file
{
"galaxy.meteor.com": {
"env": { "MONGO_URL": "mongodb://..." },
"baseImage": {
"repository": "meteor/galaxy-puppeteer",
"tag": "latest"
}
}
}
Meteor Galaxy Docs:
Freshly Released meteor-puppeteer Docker Image on GitHub:
I followed the instructions in the galaxy docs, but I’m still getting the following errors:
(node:8) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[0513/175101.669695:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
at Interface.<anonymous> (/app/bundle/programs/server/npm/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:68)
at onClose (/app/bundle/programs/server/npm/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at Socket.onend (readline.js:194:10)
at Interface.close (readline.js:416:8)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at Socket.EventEmitter.emit (domain.js:483:12)
at Socket.emit (events.js:326:22)
at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
=> awaited here:
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 27)
at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
at imports/api/puppeteer.js:24:17
(node:8) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 28)
at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
at imports/api/puppeteer.js:98:17
at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
=> awaited here:
at processTicksAndRejections (internal/process/task_queues.js:84:21)
at endReadableNT (_stream_readable.js:1241:12)
at Socket.EventEmitter.emit (domain.js:483:12)
at Socket.emit (events.js:326:22)
at Socket.onend (readline.js:194:10)
at Interface.close (readline.js:416:8)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.emit (events.js:326:22)
at Interface.<anonymous> (/app/bundle/programs/server/npm/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:68)
at onClose (/app/bundle/programs/server/npm/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)
Anyone else running into this issue or able to get Puppeteer working on Galaxy?
Looks like you just might need to add the Meteor Galaxy Docker args
when launching the puppeteer browser.
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage'
]
});
const page = await browser.newPage();
await page.goto("https://www.google.com");
I had to read a bit about why --no-sandbox
is required and I found this Github page helpful.
This is a common approach used when running puppeteer on a Docker container.