Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nodejs16.x #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add support for nodejs16.x #274

wants to merge 1 commit into from

Conversation

styfle
Copy link

@styfle styfle commented May 13, 2022

@shooit
Copy link

shooit commented Jun 7, 2022

@alixaxel It would be awesome to get this one merged so that we are able to run on the latest runtime 🙏

@VesterDe
Copy link

VesterDe commented Jun 20, 2022

We would be really grateful if this can be merged, it's blocking us from upgrading our infra on Lambda. 🙏

@bitconym
Copy link

Please merge it, as it's crucial for to use it with Node.js v16.

@turakvlad
Copy link

We need this as well. It would be really great if @alixaxel could merge it. Thank you!

@Spawnrad
Copy link

Spawnrad commented Jul 6, 2022

It would be really great

@bitconym
Copy link

bitconym commented Jul 6, 2022

@alixaxel is this repo maintained? Any reason why so much delay with merging this update? Almost 2 months...

@urish
Copy link

urish commented Jul 19, 2022

Works like a charm. I use patch-package with the following patch file as a workaround for now:

diff --git a/node_modules/chrome-aws-lambda/build/index.js b/node_modules/chrome-aws-lambda/build/index.js
index f78e183..599af55 100644
--- a/node_modules/chrome-aws-lambda/build/index.js
+++ b/node_modules/chrome-aws-lambda/build/index.js
@@ -7,7 +7,7 @@ const fs_1 = require("fs");
 const lambdafs_1 = __importDefault(require("lambdafs"));
 const path_1 = require("path");
 const url_1 = require("url");
-if (/^AWS_Lambda_nodejs(?:10|12|14)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
+if (/^AWS_Lambda_nodejs(?:10|12|14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
     if (process.env.FONTCONFIG_PATH === undefined) {
         process.env.FONTCONFIG_PATH = '/tmp/aws';
     }
@@ -145,7 +145,7 @@ class Chromium {
             lambdafs_1.default.inflate(`${input}/chromium.br`),
             lambdafs_1.default.inflate(`${input}/swiftshader.tar.br`),
         ];
-        if (/^AWS_Lambda_nodejs(?:10|12|14)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
+        if (/^AWS_Lambda_nodejs(?:10|12|14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
             promises.push(lambdafs_1.default.inflate(`${input}/aws.tar.br`));
         }
         return Promise.all(promises).then((result) => result.shift());

Save this file in your project as patches/chrome-aws-lambda+10.1.0.patch, install patch-package and add the following script to your package.json:

 "scripts": {
+  "postinstall": "patch-package"
 }

@bitconym
Copy link

bitconym commented Aug 3, 2022

@Edweis are you going to maintain this project since I see you approved the PR? Can you merge it? I switched using https://github.com/Sparticuz/chrome-aws-lambda since @Sparticuz currently maintains it.

@shaunhurley
Copy link

shaunhurley commented Aug 28, 2022

Works like a charm. I use patch-package with the following patch file as a workaround for now:

diff --git a/node_modules/chrome-aws-lambda/build/index.js b/node_modules/chrome-aws-lambda/build/index.js
index f78e183..599af55 100644
--- a/node_modules/chrome-aws-lambda/build/index.js
+++ b/node_modules/chrome-aws-lambda/build/index.js
@@ -7,7 +7,7 @@ const fs_1 = require("fs");
 const lambdafs_1 = __importDefault(require("lambdafs"));
 const path_1 = require("path");
 const url_1 = require("url");
-if (/^AWS_Lambda_nodejs(?:10|12|14)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
+if (/^AWS_Lambda_nodejs(?:10|12|14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
     if (process.env.FONTCONFIG_PATH === undefined) {
         process.env.FONTCONFIG_PATH = '/tmp/aws';
     }
@@ -145,7 +145,7 @@ class Chromium {
             lambdafs_1.default.inflate(`${input}/chromium.br`),
             lambdafs_1.default.inflate(`${input}/swiftshader.tar.br`),
         ];
-        if (/^AWS_Lambda_nodejs(?:10|12|14)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
+        if (/^AWS_Lambda_nodejs(?:10|12|14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) {
             promises.push(lambdafs_1.default.inflate(`${input}/aws.tar.br`));
         }
         return Promise.all(promises).then((result) => result.shift());

Save this file in your project as patches/chrome-aws-lambda+10.1.0.patch, install patch-package and add the following script to your package.json:

 "scripts": {
+  "postinstall": "patch-package"
 }

Hi @urish, looking to try this approach in the short term till this gets commited. I get using patch-package, I'm a little confused on what constitutes "the following patch file" in your example - is it, literally, copying the code segment in your example to patches/chrome-aws-lambda+10.1.0.patch? Or copying the entire updated file from the commit on github?

Thanks!

@tudorsandu
Copy link

Would be great to merge this, is there anything blocking this PR? would be happy to help if there is

@truuth-of-abhi
Copy link

can we get this merged please?

@bitconym
Copy link

@truuth-of-abhi I don't think the repository is maintained anymore, better to switch to this fork: https://github.com/Sparticuz/chrome-aws-lambda

@experionsachin
Copy link

experionsachin commented Mar 23, 2023

The latest repository is https://www.npmjs.com/package/@sparticuz/chromium.
Working well with node 18 and AWS Lambda.

styfle added a commit to vercel/vercel that referenced this pull request Aug 15, 2023
This PR upgrades test fixtures from Node.js 14 to 16 and also removes
the `35-puppeteer` test fixture since it doesn't support Node.js 16
unfortunately.

- See alixaxel/chrome-aws-lambda#274

---------

Co-authored-by: Steven <[email protected]>
TooTallNate added a commit to vercel/vercel that referenced this pull request Aug 17, 2023
This PR upgrades test fixtures from Node.js 14 to 16 and also removes
the `35-puppeteer` test fixture since it doesn't support Node.js 16
unfortunately.

- See alixaxel/chrome-aws-lambda#274

---------

Co-authored-by: Steven <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.