I'm currently just trying to deploy the example to make sure everything is working in my setup but I'm getting an error.
When I hit the URL I get {"message": "Internal server error"}
Looking at the logs in CloudWatch gives the following:
{
"errorMessage": "socket hang up",
"errorType": "Error",
"stackTrace": [
"createHangUpError (_http_client.js:253:15)",
"Socket.socketOnEnd (_http_client.js:345:23)",
"emitNone (events.js:91:20)",
"Socket.emit (events.js:185:7)",
"endReadableNT (_stream_readable.js:974:12)",
"_combinedTickCallback (internal/process/next_tick.js:80:11)",
"process._tickDomainCallback (internal/process/next_tick.js:128:9)"
]
}
Not sure if it's relevant but when I run npm run deploy there is a warning:
[53] ./.build/src/handlers/vd711qcy1sj___pdf.js 2.41 kB {0} [built]
+ 68 hidden modules
WARNING in ./node_modules/ws/lib/BufferUtil.js
Module not found: Error: Can't resolve 'bufferutil' in '/Users/yeldarb/Code/lambda-christmas-corner/examples/serverless-framework/aws/node_modules/ws/lib'
@ ./node_modules/ws/lib/BufferUtil.js 35:21-42
@ ./node_modules/ws/lib/Receiver.js
@ ./node_modules/ws/index.js
@ ./node_modules/chrome-remote-interface/lib/chrome.js
@ ./node_modules/chrome-remote-interface/index.js
@ ./.build/src/handlers/8g27tg3rgmw___requestLogger.js
@ ./.build/src/handlers/requestLogger.js
WARNING in ./node_modules/@serverless-chrome/lambda/dist/bundle.es.js
Module not found: Error: Can't resolve 'chrome-launcher' in '/Users/yeldarb/Code/lambda-christmas-corner/examples/serverless-framework/aws/node_modules/@serverless-chrome/lambda/dist'
@ ./node_modules/@serverless-chrome/lambda/dist/bundle.es.js 291:52-78
@ ./.build/src/handlers/version.js
WARNING in ./node_modules/ws/lib/Validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/yeldarb/Code/lambda-christmas-corner/examples/serverless-framework/aws/node_modules/ws/lib'
@ ./node_modules/ws/lib/Validation.js 10:22-47
@ ./node_modules/ws/lib/Receiver.js
@ ./node_modules/ws/index.js
@ ./node_modules/chrome-remote-interface/lib/chrome.js
@ ./node_modules/chrome-remote-interface/index.js
@ ./.build/src/handlers/8g27tg3rgmw___requestLogger.js
@ ./.build/src/handlers/requestLogger.js
I was experiencing a problem like this. As mentioned in #168 , the problem seems to originate from --v=99 from this line:
You can remove that command from node_modules/@serverless-chromium/lambda/dist/bundle.cjs.js and node_modules/@serverless-chromium/lambda/dist/bundle.es.js, or simply ensure that process.env.DEBUG is falsey.
Thanks @alukach . I had the exact same issue with node v8.10 and latest serverless version. Was getting the error
Error capturing screenshot for http://www.gmail.com { Error: socket hang up
at createHangUpError (_http_client.js:253:15)
at Socket.socketOnEnd (_http_client.js:345:23)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' }
I digged into node modules as mentioned and removed the portion '--v=99' from both the files node_modules/@serverless-chromium/lambda/dist/bundle.cjs.js and node_modules/@serverless-chromium/lambda/dist/bundle.es.js. Deployed again and the screenshot function works for me. Great!
Most helpful comment
Thanks @alukach . I had the exact same issue with node v8.10 and latest serverless version. Was getting the error
Error capturing screenshot for http://www.gmail.com { Error: socket hang up at createHangUpError (_http_client.js:253:15) at Socket.socketOnEnd (_http_client.js:345:23) at emitNone (events.js:91:20) at Socket.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' }I digged into node modules as mentioned and removed the portion
'--v=99'from both the filesnode_modules/@serverless-chromium/lambda/dist/bundle.cjs.jsandnode_modules/@serverless-chromium/lambda/dist/bundle.es.js. Deployed again and the screenshot function works for me. Great!