Cannot build or deploy with chrome-aws-lambda

I’ve opened this as a bug on their repo but also posting here in case someone knows how to overcome the problem.

Running locally everything works.
Building results in the following warning:

node_modules/chrome-aws-lambda/build/index.js:188:12: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning)
    188 │             require(`${__dirname}/puppeteer/lib/${overload}`)

As it is only a warning i deployed it to see if it would work and the request to the endpoint returns an empty response almost immediately when it should take circa 10 seconds or so.

Managed to solve this using layers and hosting the chrome-aws-lamdba there instead of bundling with the project. Found the answer in the serverless-stack slack discussions by searching chrome-aws-lambda

Thanks

1 Like