MIgrate outside docker

I don’t think is a Mac issue. How could you add puppeteer to the existing docker proyect created using wappler?

Yes, I understand that. But I can’t understand how could a proyect running on docker won’t run in the host.

Now it’s throwing me this error:

Navigate to your project folder in terminal and type

npm i puppeteer-core

It should now be installed and added to your package.json file

Not the solution, the error persists. Please check this topic: HTML to PDF Action - NodeJS & PHP [Open Source]

I get this error after installing puppeteer-core:

message: “Failed to launch the browser process!\n/opt/node_app/node_modules/puppeteer/.local-chromium/linux-869685/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n
stack: “Error: Failed to launch the browser process!\n/opt/node_app/node_modules/puppeteer/.local-chromium/linux-869685/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n\n at onClose (/opt/node_app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)\n at Interface. (/opt/node_app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:68)\n at Interface.emit (events.js:326:22)\n at Interface.close (readline.js:416:8)\n at Socket.onend (readline.js:194:10)\n at Socket.emit (events.js:326:22)\n at endReadableNT (_stream_readable.js:1241:12)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)”
status: “500”

Are you just installing the core Puppeteer package or trying to install Puppeteer and its Chrome component? We just used the core has have no need for the full Chrome version… May be where the issue is?

I believe I need the chrome component because I need to export a HTML to PDF using puppeteer

Is this so @sid

If you check the topic where @sid created the custom module, I need the full puppeteer package working.

Topic: HTML to PDF Action - NodeJS & PHP [Open Source]

Sorry meant to tag Sid not Jon…

1 Like

If you need chromium installed as well you do

npm i puppeteer

1 Like

The package won’t work because the docker container needs a chromuim/puppeteer service running. In order to do that, I would need to “merge” (compose) my docker proyect with a puppeteer docker proyect. I’ve tried out that already and won’t work.

My only solution right now (unless someone could compose inside the docker container the puppeteer service) is to target my proyect to a non-docker machine, that would be my host (a Mac). The server is running correctly, but the database is not working.

This is what we did and it worked. Installed the core first, and its dependencies, then installed Puppeteer as directed in Sids post (which simply added Chromium). All installed fine. Deployed to remote, Docker compiled and deployed with no errors.

You do not have to touch the docker container. It has nothing to do with it. Keep all your containers in wapplers docker-compose.yml file

I created a new project to test.

  1. Press terminal

  2. npm i puppeteer

  3. Create the folder path : extensions/server_connect_modules

  4. Put custom.hjson and HtmlToPDF.js inside folder from step 3

Done

I’ve done all that already but won’t work. I don’t know why.

I keep getting this error:

message: “Failed to launch the browser process!\n/opt/node_app/node_modules/puppeteer/.local-chromium/linux-869685/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n
stack: “Error: Failed to launch the browser process!\n/opt/node_app/node_modules/puppeteer/.local-chromium/linux-869685/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n\n at onClose (/opt/node_app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)\n at Interface. (/opt/node_app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:68)\n at Interface.emit (events.js:326:22)\n at Interface.close (readline.js:416:8)\n at Socket.onend (readline.js:194:10)\n at Socket.emit (events.js:326:22)\n at endReadableNT (_stream_readable.js:1241:12)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)”
status: “500”

This is my package.json file:

{
“name”: “liquidador_r”,
“version”: “1.0.0”,
“private”: true,
“description”: “”,
“main”: “index.js”,
“engines”: {
“node”: “>=10.5.0”
},
“scripts”: {
“test”: “nyc mocha”,
“start”: “./index.js”
},
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“archiver”: “^5.0.2”,
“aws-sdk”: “^2.761.0”,
“compression”: “^1.7.4”,
“connect-redis”: “^5.0.0”,
“connect-session-knex”: “^2.0.0”,
“cookie-parser”: “^1.4.5”,
“cors”: “^2.8.5”,
“debug”: “^4.2.0”,
“dotenv”: “^8.2.0”,
“ejs”: “^3.1.5”,
“express”: “^4.17.1”,
“express-end”: “0.0.8”,
“express-fileupload”: “^1.2.0”,
“express-redis-cache”: “^1.1.3”,
“express-session”: “^1.17.1”,
“follow-redirects”: “^1.13.0”,
“form-data”: “^2.3.3”,
“fs-extra”: “^9.0.1”,
“jsonwebtoken”: “^8.5.1”,
“knex”: “^0.21.6”,
“mime-types”: “^2.1.27”,
“mssql”: “^6.2.3”,
“mysql”: “^2.18.1”,
“mysql2”: “^2.2.5”,
“node-fetch”: “^2.6.1”,
“node-schedule”: “^1.3.2”,
“nodemailer”: “^6.4.11”,
“nodemon”: “^2.0.4”,
“pg”: “^8.3.3”,
“puppeteer”: “^9.1.1”,
“puppeteer-core”: “^9.1.1”,
“qrcode”: “^1.4.4”,
“qs”: “^6.9.4”,
“redis”: “^3.0.2”,
“session-file-store”: “^1.5.0”,
“sharp”: “^0.26.1”,
socket.io”: “^3.0.2”,
“socket.io-redis”: “^6.0.1”,
“speakeasy”: “^2.0.0”,
“sqlite3”: “5.0.0”,
“stripe”: “^8.137.0”,
“unzipper”: “^0.10.11”,
“uuid”: “^8.3.0”
},
“devDependencies”: {
“mocha”: “^8.1.3”,
“nyc”: “^15.1.0”,
“supertest”: “^5.0.0”
},
“nodemonConfig”: {
“watch”: [
“app”,
“lib”,
“views”,
“extensions”,
“tmp/**/restart.txt”
],
“ext”: “ejs,js,json”
}
}

Have you checked that the files are present in your node_modules folder ?

Here they are:

Maybe (I can’t understand how) it’s a Mac bug.

Strange.

Im on a mac as well

To everyone that helped me, I could solve the target migration issue. Spoiler alert: I couldn’t run puppeteer on my Docker proyect.

On the bug I reported, I explained how I could create a new target on a docker-based proyect: Migrating from docker server to local server

Thanks to: @sid , @mebeingken , @JonL , @Teodor , @Dave and last (but not least) @namakemono

I love this community, it’s wappler’s most valuable asset.

1 Like

Yes. As I see in your post later, you were able to install and run the app.

I have not been able to find time to experiment with Puppeteer and Docker yet. But it looks like its not a big deal. Will try to add this to my original post.

@salvuccicarlos Your project might have been stuck due to some other reason I think, causing issues for you. Although, I understand from your last post that you have a work around for now, so thats great. :slightly_smiling_face:

Glad you got it fixed! But if you were happy with docker you should keep investigating how to create the right dockerfile as I know it can be done.

2 Likes