Navigation failed because browser has disconnected error on AWS Lambda
See original GitHub issueI’m using puppeteer-core
on AWS Lambda with chromium builds taken here.
I create a new browser instance per lambda invocation, like this:
const browser = await puppeteer.launch({
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox',
'--no-zygote',
'--single-process',
],
executablePath: './bin/headless-chromium',
userDataDir: '/tmp/puppeteer_data'
});
Everything works fine except when I have many, many invocations of this lambda. It’s hard to tell how many but I’d say ~ 500 invocations near the same time.
error: Error: Navigation failed because browser has disconnected!
at CDPSession.LifecycleWatcher._eventListeners.helper.addEventListener (/var/task/node_modules/puppeteer-core/lib/FrameManager.js:1181:107)
at emitNone (events.js:106:13)
at CDPSession.emit (events.js:208:7)
at CDPSession._onClosed (/var/task/node_modules/puppeteer-core/lib/Connection.js:231:10)
at Connection._onClose (/var/task/node_modules/puppeteer-core/lib/Connection.js:121:15)
at WebSocketTransport._ws.addEventListener.event (/var/task/node_modules/puppeteer-core/lib/WebSocketTransport.js:45:22)
at WebSocket.onClose (/var/task/node_modules/puppeteer-core/node_modules/ws/lib/event-target.js:124:16)
at emitTwo (events.js:126:13)
at WebSocket.emit (events.js:214:7)
at WebSocket.emitClose (/var/task/node_modules/puppeteer-core/node_modules/ws/lib/websocket.js:180:10)
-- ASYNC --
at Frame.<anonymous> (/var/task/node_modules/puppeteer-core/lib/helper.js:144:27)
at Page.goto (/var/task/node_modules/puppeteer-core/lib/Page.js:624:49)
at Page.<anonymous> (/var/task/node_modules/puppeteer-core/lib/helper.js:145:23)
at getHTML (/var/task/src/details/details.js:100:16)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
This error keeps going on for each event that triggers the lambda, until the lambda container is gone.
- Puppeteer version: 1.11.0
- Platform / OS version: AWS Lambda
- URLs (if applicable):
- Node.js version: 8.10
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:22 (1 by maintainers)
Top Results From Across the Web
Error: Navigation failed because browser has disconnected ...
The Navigation failed because browser has disconnected error usually means that the node scripts that launched Puppeteer ends without ...
Read more >Navigation failed because browser has disconnected!
[1] Navigation failed because browser has disconnected! (An internal WebSocket error occurred. Please see the innerException, if present, for ...
Read more >error: navigation failed because browser has disconnected!
The Navigation failed because browser has disconnected error usually means that the node scripts that launched Puppeteer ends without waiting for the Puppeteer...
Read more >[BUG] Navigation failed because browser has disconnected ...
Hi Just want to share an issue I found that bothered me for a while, which might have something to do with the...
Read more >Troubleshooting a failed canary - Amazon CloudWatch
This error appears if there are some network requests after the page or browser is closed. You might have forgotten to wait for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like a dupe of #2463
--single-process
flag solved the issue for me.