I’m running into a frustrating issue with my serverless setup and could really use some help.
My current environment:
- Puppeteer version 1.2.0
- AWS Lambda runtime 2017.03
- Node.js 6.10.3
The problem happens every time I try to navigate to websites using browser.goto(). I’ve tested it with different sites like government pages and they all fail with the same error. Here’s what I see in the debug output:
Timestamp: Mon, 19 Mar 2018 14:45:18 GMT puppeteer:session ◀ RECV
{
"method": "Network.loadingFailed",
"params": {
"requestId": "B25C9FEA89D53EEF48G16F0936DFFC45",
"timestamp": 1456.823471,
"type": "Document",
"errorText": "net::ERR_INSUFFICIENT_RESOURCES",
"canceled": false
}
}
What’s really confusing is that my Lambda function has 1536MB allocated to it, but when the function eventually times out, the logs show that only 166MB was actually used.
Has anyone encountered this before? What could be causing this resource error when there seems to be plenty of memory available?
Oh yeah, I’ve seen this! It’s not actually a memory issue - Chrome runs out of file descriptors or processes. Bump up your Lambda timeout since it sometimes just needs more time to get everything running. That Puppeteer version is ancient though - 1.2.0 had a bunch of Lambda bugs that were fixed in later releases. If you can’t upgrade yet, definitely use --disable-dev-shm-usage like mentioned above, and throw in --disable-gpu too.
This isn’t actually a memory issue - it’s Lambda’s containerization limits causing problems. I’ve seen the same thing when Chrome runs out of process slots or file handles before hitting memory limits. Your debug output shows network loading failures, which usually means Chrome can’t spawn the processes it needs for rendering. Besides those launch flags you mentioned, try dropping Lambda concurrency temporarily to see if it’s container resource contention. Node 6.10.3 has known resource management bugs - upgrade to a newer runtime if you can. Also check your Lambda execution role permissions. Restricted IAM policies sometimes show up as resource errors in Chrome’s networking layer.
This error isn’t actually about memory - it’s Chrome’s process isolation clashing with Lambda’s constraints. I hit the same issue last year and adding --disable-dev-shm-usage to your launch args usually fixes it. Lambda containers have really limited shared memory space, so Chrome fails even when there’s plenty of heap memory available. Also, you’re running Node 6.10.3 which is ancient - newer versions handle resources way better. Try launching with {args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--single-process']}. The single-process flag works great in serverless since process spawning gets messy there.
This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.