Node 16.x is supported? #275
outaTiME opened this issue ยท 15 comments
I am having the following error when I try to run my lambda with node 16.x, does anyone else get this?
"Failed to launch the browser process!\n/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n"
Have you tried downgrading? Did it work? Going to try with 14 and see if it fixes the issue ๐ค
UPD: Looks like it worked. At least no missing libs issue anymore. But now I have browser hanging :D Fun
Right, this layer depends on https://github.com/alixaxel/chrome-aws-lambda and the upstream repo hasn't been updated to support Node 16 yet.
I see @outaTiME already raise the issue there: alixaxel/chrome-aws-lambda#275
I've just published a new layer version 27 that has the latest Chromium and Node 16 support!
Thanks again for pointing this out!
Hi @vladgolubev,
for some reason the new layer does not work for me, it gives me the following error:
{
"error type": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '@sparticuz/chrome-aws-lambda'\nRequire stack:\n- /var/task/src/subscribers/social-notify.js\n- /var/ runtime/index .mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '@sparticuz/chrome-aws-lambda'",
"Require stack:",
"- /var/task/src/subscribers/social-notify.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:726:17)",
" at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)",
" in async file:///var/runtime/index.mjs:781:15",
" in async file: ///var/runtime/index.mjs:4:1"
]
}
but if I manually download and configure the artifact (https://github.com/Sparticuz/chrome-aws-lambda/suites/6829349165/artifacts/263061533) it works like a charm,
could it be that you have left some misconfigured route when you did the deployment?
@outaTiME hm, strange, what I did is just package the same artifact zip as is into a layer
Maybe it's b/c zip has extra nodejs folder inside?
I've just published v28 with that change, could you please try it ?
Unfortunately using 28 throws the same error, locally my structure for the layer is as follows:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '@sparticuz/chrome-aws-lambda'\nRequire stack:\n- /var/task/packages/api/src/subscribers/social-notify.js\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '@sparticuz/chrome-aws-lambda'",
"Require stack:",
"- /var/task/packages/api/src/subscribers/social-notify.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:726:17)",
" at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)",
" at async file:///var/runtime/index.mjs:781:15",
" at async file:///var/runtime/index.mjs:4:1"
]
}
the error message gives the feeling that the @sparticuz/chrome-aws-lambda package is not available within the layer (or at least within that file structure),
and as I told you before, I simply unzipped the artifact in a folder called "chrome":
I also tell you that I am using SST, I show you a little about the definition of my layer:
const layerArn =
"arn:aws:lambda:us-east-1:764866452798:layer:chrome-aws-lambda:28";
socialNotify: {
function: {
handler: 'src/subscribers/social-notify.handler',
bundle: {
externalModules: ['@sparticuz/chrome-aws-lambda'],
},
layers: [
new lambda.LayerVersion(stack, 'ChromeLayer', {
code: lambda.Code.fromAsset('packages/api/layers/chrome'),
}),
// commented out to leave the local layer which is the one that works
// LayerVersion.fromLayerVersionArn(stack, "ChromeLayer", layerArn),
],
// ~30s
timeout: '1 minute',
},
cdk: {
subscription: {
filterPolicy: {
event: SubscriptionFilter.stringFilter({
allowlist: ['social-notify'],
}),
},
},
},
},So apparently, embedding node_modules inside nodejs folder is required, so I reverted that change in the v29.
I'm not familiar with SST so maybe the issue is with it somehow?
Regardless of SST and the layer has to have the following structure nodejs/node_modules (https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html), I just did a download of your layer 28 as follows:
$ aws lambda get-layer-version-by-arn --arn "arn:aws:lambda:us-east-1:764866452798:layer:chrome-aws-lambda:28"
and looking at the contents I see that the nodejs folder does not exist, unlike layer 25, which does have one, I am enclosing a reduced comparison of the contents between both versions:
btw, you can also see some dirt in the zip, like the descriptors (__MACOSX) which can possibly be removed to make everything much cleaner
@outaTiME what about layer version 29? it should have the nodejs enclosing folder now.
Thanks for pointing out the dirt. I can see that + some other stuff to be removed (like .d.ts files or browser build of libraries)
yay, @vladgolubev, the layer 29 works amazing ๐
Thank you very much, for all your work and support !!!
You're welcome! And thank you too!
v30 w/o junk (~2 MB of junk removed) will be published as soon as Docker Hub will get up ๐
Great, I'm trying a new layer 30 as soon as it's available, thanks again !!!
I just downloaded layer 30, and I keep seeing dirt in the __MACOSX folders, could it be?
Automated zipping via create-zip.sh as turns out macOS will create that junk if you zip from UI.
Now it shouldn't be!
I've published v31 and I don't see any that junk anymore!
sweet, everything works amazing, thanks again @vladgolubev !!!


