Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppeteer error: UnhandledPromiseRejectionWarning: Error: Failed to launch chrome! #1032

Closed
jywarren opened this issue Apr 19, 2019 · 22 comments

Comments

@jywarren
Copy link
Member

The VERY exciting work in #1021 and #1007 has enabled node-based WebGL processing. However, I'm working to get it running on Google Cloud and am encountering this error there, and also running it via the index.js CLI, for exampe:

./index.js -s webgl-distort -i examples/images/test.png

yields:

⠙ Your Image is being processed..(node:6996) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
/home/warren/sites/image-sequencer/node_modules/puppeteer/.local-chromium/linux-641577/chrome-linux/chrome: 1: /home/warren/sites/image-sequencer/node_modules/puppeteer/.local-chromium/linux-641577/chrome-linux/chrome: Syntax error: word unexpected (expecting ")")


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/home/warren/sites/image-sequencer/node_modules/puppeteer/lib/Launcher.js:342:14)
    at Interface.helper.addEventListener (/home/warren/sites/image-sequencer/node_modules/puppeteer/lib/Launcher.js:331:50)
    at emitNone (events.js:111:20)
    at Interface.emit (events.js:208:7)
    at Interface.close (readline.js:370:8)
    at Socket.onend (readline.js:149:10)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
(node:6996) 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(). (rejection id: 1)
(node:6996) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'm also trying to get it to run headless in #1031 because of an issue I found there. Any help appreciated! This is very very close based on great work from several of you! @tech4GT @VibhorCodecianGupta @Divy123 @harshkhandeparkar --

Thanks!

@harshkhandeparkar
Copy link
Member

Can't we use headless firefox? Is it available? Firefox is a lot more stable as compared to chromium. @VibhorCodecianGupta?

@vibhorgupta-gh
Copy link

vibhorgupta-gh commented Apr 20, 2019

Puppeteer is chromium specific, it's a subproject of the Chromium project. Switching to Firefox would essentially mean switching to some other web driver like selenium. Let's try resolving this first, if it's too much of an issue, then we can see what comes next.

cc @jywarren

@harshkhandeparkar
Copy link
Member

Why don't we switch to firefox? It will fix the problems and also make it future proof. What do you say?

@vibhorgupta-gh
Copy link

vibhorgupta-gh commented Apr 20, 2019

TL;DR

@jywarren from the conversation on the above-mentioned forums, it looks like it was a GCF bug which was solved. People claimed that earlier versions were working for them, like v1.7.0 (perhaps we could try that?) but someone from the team confirmed that tests were failing, following which they fixed it.

For some reason though, we are still facing this issue. People also mentioned how sometimes redeploying made it work, rebuilding the project and redeploying also made it work. In short, it's flaky. Maybe you could try out a few alternatives given in the issue comment. We're using Node 8 runtime, right?
Also, check #1031

@harshkhandeparkar
Copy link
Member

We actually have support for nide 6, 8, 10. I had suggested to drop node 6 support and jywarren had agreed. Should we do that?

@Divy123
Copy link
Member

Divy123 commented Apr 22, 2019

@harshkhandeparkar I also think due to some dependencies and other features we may add in future do not work on node v6, it can be dropped!

@harshkhandeparkar
Copy link
Member

great!

@jywarren
Copy link
Member Author

jywarren commented Apr 30, 2019

Trying 2 things:

  1. i switched the function to Node 10 just to see
  2. i cloned it to is-function-edge and pointed it at the branch update puppeteer for headless #1031, to see if those options work: https://us-central1-public-lab.cloudfunctions.net/is-function-edge/api/v1/process/?steps=[{%22id%22:1,%22input%22:%22https://publiclab.org/i/31655.jpg%22,%22steps%22:%22webgl-distort{nw:0,101|ne:1023,-51|se:1223,864|sw:100,764}%22}]

@jywarren
Copy link
Member Author

But we are still seeing the settings parsing error, so i removed the options string from webgl, and let it run on defaults... https://us-central1-public-lab.cloudfunctions.net/is-function-edge/api/v1/process/?steps=[{%22id%22:1,%22input%22:%22https://publiclab.org/i/31655.jpg%22,%22steps%22:%22webgl-distort%22}]

@jywarren
Copy link
Member Author

On the edge one pointed at #1031, i still get:

 severity:  "ERROR"  
 textPayload:  "Error: Failed to launch chrome!
[0430/180647.159539:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/srv/node_modules/puppeteer/lib/Launcher.js:342:14)
    at Interface.helper.addEventListener (/srv/node_modules/puppeteer/lib/Launcher.js:331:50)
    at emitNone (events.js:111:20)
    at Interface.emit (events.js:208:7)
    at Interface.close (readline.js:368:8)
    at Socket.onend (readline.js:147:10)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)"  

@jywarren
Copy link
Member Author

Ooh, actually that's different: Running as root without --no-sandbox is not supported. -- i'll try the second flag and remove --no-sandbox for now

@jywarren
Copy link
Member Author

Erg, meant the reverse. I'll try with --no-sandbox now.

Update: OoOOOOooooOO! This is looking promising!

Error: ENOENT: no such file or directory, open '/srv/node_modules/image-sequencer/dist/image-sequencer.js' -- ASYNC -- at Frame.<anonymous> 

I think we need to build this and merge it, and then puppeteer will use the dist file!!!

@jywarren
Copy link
Member Author

jywarren commented Apr 30, 2019

trying this: https://us-central1-public-lab.cloudfunctions.net/is-function-edge/api/v1/process/?steps=[{%22id%22:1,%22input%22:%22https://publiclab.org/i/31655.jpg%22,%22steps%22:%22webgl-distort%22}]

@jywarren
Copy link
Member Author

I think this is, technically, running. but it's timing out:

D  is-function-edge seoypnpvit56 Function execution started is-function-edge seoypnpvit56 
D  is-function-edge seoypnpvit56 Function execution took 540002 ms, finished with status: 'timeout' is-function-edge seoypnpvit56 
D  is-function-edge 9dk3fdwlxj7s Function execution started is-function-edge 9dk3fdwlxj7s 
D  is-function-edge 9dk3fdwlxj7s Function execution took 540002 ms, finished with status: 'timeout' is-function-edge 9dk3fdwlxj7s 
D  is-function-edge 9dk3q9p96u72 Function execution started is-function-edge 9dk3q9p96u72 

@jywarren
Copy link
Member Author

OK, well -- with a small image, this works!!!

https://us-central1-public-lab.cloudfunctions.net/is-function-edge/api/v1/process/?steps=[{%22id%22:1,%22input%22:%22https://i.publiclab.org/system/images/photos/000/000/354/thumb/Boots-ground-02.png%22,%22steps%22:%22webgl-distort%22}]

Input:

Output:

image

@jywarren
Copy link
Member Author

And with two images, i'm seeing SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at exports.multiSequencer (/srv/index.js:13:22) -- it seems to be having trouble parsing the comma without a newline here:

https://us-central1-public-lab.cloudfunctions.net/is-function-edge/api/v1/process/?steps=[{"id":1,"input":"https://i.publiclab.org/i/31778.png","steps":"webgl-distort"},{"id":2,"input":"https://i.publiclab.org/i/31778.png","steps":"webgl-distort"}]

A better test input:

test

@jywarren
Copy link
Member Author

Strange, because when i copy paste it into here, it's valid JSON: https://duckduckgo.com/?q=json+validator&atb=v121-6&ia=answer

@jywarren
Copy link
Member Author

And:

> JSON.parse('[{"id":1,"input":"https://i.publiclab.org/i/31778.png","steps":"webgl-distort"},{"id":2,"input":"https://i.publiclab.org/i/31778.png","steps":"webgl-distort"}]')
[ { id: 1,
    input: 'https://i.publiclab.org/i/31778.png',
    steps: 'webgl-distort' },
  { id: 2,
    input: 'https://i.publiclab.org/i/31778.png',
    steps: 'webgl-distort' } ]

@jywarren
Copy link
Member Author

jywarren commented Apr 30, 2019

@jywarren
Copy link
Member Author

jywarren commented Apr 30, 2019

It's not completing... but no errors yet... ahhh, ok, timeout: Function execution took 540002 ms, finished with status: 'timeout'

anyways, next step would be to try to pull in the output of one sequencer into the other, with a sequence like: import-image{url:https://i.publiclab.org/i/31778.png},overlay{x:10|y:20}

Actually, with the function code @tech4GT has written, we should be able to point at the output of the earlier step with a number as input, and then use overlay:

https://us-central1-public-lab.cloudfunctions.net/is-function-edge/api/v1/process/?steps=[{"id":1,"input":"https://i.publiclab.org/i/31778.png","steps":"webgl-distort"},{"id":2,"input":1,"steps":"import-image{url:https://i.publiclab.org/i/31778.png},overlay"}]

@jywarren
Copy link
Member Author

Closing this puppeteer issue and moving back to publiclab/image-sequencer-app#6 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants