Skip to content

Add support for nodejs16.x#274

Open
styfle wants to merge 1 commit into
alixaxel:masterfrom
styfle:patch-1
Open

Add support for nodejs16.x#274
styfle wants to merge 1 commit into
alixaxel:masterfrom
styfle:patch-1

Conversation

@styfle

@styfle styfle commented May 13, 2022

Copy link
Copy Markdown

@shooit

shooit commented Jun 7, 2022

Copy link
Copy Markdown

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

@VesterDe

VesterDe commented Jun 20, 2022

Copy link
Copy Markdown

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

@bitconym

Copy link
Copy Markdown

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

@turakvlad

Copy link
Copy Markdown

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

@Spawnrad

Spawnrad commented Jul 6, 2022

Copy link
Copy Markdown

It would be really great

@bitconym

bitconym commented Jul 6, 2022

Copy link
Copy Markdown

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

@urish

urish commented Jul 19, 2022

Copy link
Copy Markdown

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

bitconym commented Aug 3, 2022

Copy link
Copy Markdown

@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

shaunhurley commented Aug 28, 2022

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

can we get this merged please?

@bitconym

Copy link
Copy Markdown

@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

experionsachin commented Mar 23, 2023

Copy link
Copy Markdown

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 <steven@ceriously.com>
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 <steven@ceriously.com>
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.