So after hours of battling what settings to use I finally got my function to work but now if I change even a single setting, like removing a space, the code starts producing an error after a new build.
My function utilizes puppeteer-core (9.1.1), chrome-aws-lamba (9.1.0), discord.js (12.5.3 had to downgrade to get it to work with node 12). I run esbuild with node_bundler in the netlify.toml to keep it under the 50mb limit. I use NODE_VERSION=12 and AWS_LAMBDA_JS_RUNTIME=nodejs12.x along with the 2 other discord envs in the netlify UI.
All the documentation points to needing AWS_LAMBDA_JS_RUNTIME=nodejs12.x as a env but that doesn’t seem to change anything and keeps installing node as 16 BUT when I add NODE_VERSION=12 that is what downgrades the node version.
I am using these versions of packages because that is what I finally got it working with. I am open to more options but I just find it weird I can’t even change the discord env or remove a space from the code without it breaking.
Last working deploy
Changed the WHATCHANNEL_ID env in the netlify UI and retriggered a deploy and it no longer works
GitHub of the last working code when the function works.
The error that happens IF anything changes is
ERROR Invoke Error {"errorType":"Error","errorMessage":"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","stack":["Error: Failed to launch the browser process!","/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory","","","TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md",""," at onClose (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)"," at Interface.<anonymous> (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:184:68)"," at Interface.emit (node:events:539:35)"," at Interface.close (node:readline:586:8)"," at Socket.onend (node:readline:277:10)"," at Socket.emit (node:events:539:35)"," at endReadableNT (node:internal/streams/readable:1345:12)"," at processTicksAndRejections (node:internal/process/task_queues:83:21)"]}
If I change an environment variable for my discord channel (without touching the code) and trigger a new deploy that will produce the same error. I cannot change any settings or breaks.
I have this feeling it’s because I am on a Mac 99% of the time but when I was messing with this at my house I originally got it working on my Windows PC. I think there must be an issue with node modules installed from Mac vs Windows but maybe someone knows how to get around this?