pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.21k stars 3.63k forks source link

Puppeteer not runs in Heroku #381

Closed nicolascavallin closed 3 years ago

nicolascavallin commented 3 years ago

The app runs fine in Macos, but when I tried to deploy in Heroku it's failed.

I used different kinds of setups in Puppeteer like --no-sandbox and headless, even I followed the Puppeteer guide for Heroku, but I couldn't make it.

Could someone run on Heroku?

Thanks.

liimalim commented 3 years ago

i use heroku and add buildpack

https://buildpack-registry.s3.amazonaws.com/buildpacks/jontewks/puppeteer.tgz

nicolascavallin commented 3 years ago

i use heroku and add buildpack

https://buildpack-registry.s3.amazonaws.com/buildpacks/jontewks/puppeteer.tgz

This has solved my problem.

Thank you very much!

mpirescarvalho commented 3 years ago

Hey @nicolascavallin, Did you manage to make it work on heroku? It keeps stopping my app


2020-11-07T15:27:11.945234+00:00 app[web.1]: Client is ready!
2020-11-07T15:27:47.092961+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-11-07T15:27:47.116905+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-11-07T15:27:47.224565+00:00 heroku[web.1]: Process exited with status 137
2020-11-07T15:27:47.274618+00:00 heroku[web.1]: State changed from starting to crashed
nicolascavallin commented 3 years ago

@mpirescarvalho yes, it's working!

On your Heroku App go to Settings > Buildpacks, and add: https://buildpack-registry.s3.amazonaws.com/buildpacks/jontewks/puppeteer.tgz

If you add the pack after deploy, you must make a new deploy.

Feel free to contact me if you can't make it work.

nicolascavallin commented 3 years ago

@mpirescarvalho a little detail I've forgotten.

In your WAClient use as parameter:

            puppeteer: {
                args: [
                    '--no-sandbox',
                ],
            },

I hope it would work.

mpirescarvalho commented 3 years ago

@nicolascavallin thank you, that worked

ameybh commented 3 years ago

I created a follow up guide to host it on Heroku: DEPLOY.md

iamromec commented 2 years ago

@ameybhavsar24 @nicolascavallin

Adding Buildpacks increases the slug size by a lot. How are you handling such a case?

My app's without buildpack the heroku slug size is nearly 150M but after adding a buildpack, it reaches nearly 480M.

suryavmds commented 2 years ago

@nicolascavallin can you please help me to deploy in Heroku. I added the build-pack https://buildpack-registry.s3.amazonaws.com/buildpacks/jontewks/puppeteer.tgz and argument also in client

puppeteer: {
                args: [
                    '--no-sandbox',
                ],
            },

but still I'm getting this error in Heroku at=error code=H14 desc="No web processes running" method=GET path="/scan" host=waadmin.herokuapp.com request_id=1b8d453f-e5ed-46b1-91af-5b281bb4a07d fwd="103.168.240.83" dyno= connect= service= status=503 bytes= protocol=https

nicolascavallin commented 2 years ago

@nicolascavallin can you please help me to deploy in Heroku. I added the build-pack https://buildpack-registry.s3.amazonaws.com/buildpacks/jontewks/puppeteer.tgz and argument also in client

puppeteer: {
                args: [
                    '--no-sandbox',
                ],
            },

but still I'm getting this error in Heroku at=error code=H14 desc="No web processes running" method=GET path="/scan" host=waadmin.herokuapp.com request_id=1b8d453f-e5ed-46b1-91af-5b281bb4a07d fwd="103.168.240.83" dyno= connect= service= status=503 bytes= protocol=https

I've answered you by email.

seba-lc commented 2 years ago

@ameybhavsar24 @nicolascavallin

Adding Buildpacks increases the slug size by a lot. How are you handling such a case?

My app's without buildpack the heroku slug size is nearly 150M but after adding a buildpack, it reaches nearly 480M.

Were you able to solve the slug size problem? Thanks

nicolascavallin commented 2 years ago

@ameybhavsar24 @nicolascavallin Adding Buildpacks increases the slug size by a lot. How are you handling such a case? My app's without buildpack the heroku slug size is nearly 150M but after adding a buildpack, it reaches nearly 480M.

Were you able to solve the slug size problem? Thanks

Sorry, but I left Heroku behind. I'm using Puppeteer through Docker. This is my Dockerfile:

FROM node:lts-alpine

WORKDIR /app

RUN apk update && apk add --no-cache nmap && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
    apk update && \
    apk add --no-cache \
      chromium \
      harfbuzz \
      "freetype>2.8" \
      ttf-freefont \
      nss

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

COPY . /app

RUN npm install

EXPOSE 3000

CMD ["npm", "run", "start"]
digisidekickNoida commented 2 years ago

@nicolascavallin can you please help me to deploy in Heroku. I added the build-pack https://buildpack-registry.s3.amazonaws.com/buildpacks/jontewks/puppeteer.tgz and argument also in client

puppeteer: {
                args: [
                    '--no-sandbox',
                ],
            },

but still I'm getting this error in Heroku at=error code=H14 desc="No web processes running" method=GET path="/scan" host=waadmin.herokuapp.com request_id=1b8d453f-e5ed-46b1-91af-5b281bb4a07d fwd="103.168.240.83" dyno= connect= service= status=503 bytes= protocol=https

can you please help me. I am getting same type of error

at=error code=H10 desc="App crashed" method=GET path="/" host=whatsapp-automatio.herokuapp.com request_id=9e38bdc6-08ee-4be9-a075-bbbc1f0c4535 fwd="122.161.52.87" dyno= connect= service= status=503 bytes= protocol=https

QITSchedular commented 1 year ago

@nicolascavallin I deployed the application in Beanstalk but its keeps throwing the error, can you help me figure out the issue with beanstalk ?

edu-amr commented 8 months ago

Is it still possible to upload an application with WA-web.js to Heroku??? I don't want to have to register my card just to test...

alexojo commented 6 months ago

@nicolascavallin @pedroslopez is it possible to deploy an application with this packet in Vercel?

nicolascavallin commented 6 months ago

@nicolascavallin @pedroslopez is it possible to deploy an application with this packet in Vercel?

I don't think so. You need a live server and in Vercel you'll have just functions (in terms of backend). By other side, Vercel doesn't support socket. I think won't be a good option.

edu-amr commented 5 months ago

Is it still possible to upload an application with WA-web.js to Heroku??? I don't want to have to register my card just to test...

Yes, is possible and simple to deploy a application in heroku using whatsapp-web-js ($5 month)

alexojo commented 5 months ago

@edu-amr @nicolascavallin @pedroslopez ... now I am trying to deploy it but it gives me errors:

Process running mem=664M(128.4%) Error R14 (Memory quota exceeded)

Arturgrr commented 4 months ago

@edu-amr @nicolascavallin @pedroslopez ... now I am trying to deploy it but it gives me errors:

Process running mem=664M(128.4%) Error R14 (Memory quota exceeded)

im with this same problem

edu-amr commented 3 months ago

@alexojo @Arturgrr

I will help you.

NOTE: take this project of mine as a project: https://github.com/edu-amr/whatsjob-bot

1: Push your project to github

2: On Heroku, after creating the account, on the screen at "https://dashboard.heroku.com/apps" click on new -> create new app

3: Enter the name, region and click create app

4: In deploy method select GitHub, connect your GitHub and choose the desired repo

5: In the tab navigation, go to settings and in the build pack section, add the following packs:

https://github.com/jontewks/puppeteer-heroku-buildpackhttps://github.com/heroku/heroku-buildpack-google-chrome

6: Go back to the deploy tab and click on deploy branch

7: Wait for the build

NOTE: In this repo I left, on the route: https://github.com/edu-amr/whatsjob-bot/blob/main/src/api/v1/qrcode/controller.ts which generates the qr and appears on the screen to to connect. Using res.setHeader("Content-Type", "image/png");