From e0b050dacf7e4c3baaf2bad1b9cec70d7f6e2c9b Mon Sep 17 00:00:00 2001 From: Sparticuz Date: Mon, 28 Nov 2022 14:04:13 -0500 Subject: [PATCH] node 18 on lambda support --- .github/workflows/aws.yml | 3 ++- _/amazon/template.yml | 11 +++++++++++ source/index.ts | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 5ca4c1e..379ebd5 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x - name: Install Packages run: npm install @@ -42,6 +42,7 @@ jobs: version: - 14 - 16 + - 18 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/_/amazon/template.yml b/_/amazon/template.yml index 6f988b8..12e6aa5 100644 --- a/_/amazon/template.yml +++ b/_/amazon/template.yml @@ -37,3 +37,14 @@ Resources: - AWSLambdaBasicExecutionRole - AWSXRayDaemonWriteAccess Tracing: Active + node18: + Type: AWS::Serverless::Function + Properties: + Layers: + - !Ref layer + Handler: handlers/index.handler + Runtime: nodejs18.x + Policies: + - AWSLambdaBasicExecutionRole + - AWSXRayDaemonWriteAccess + Tracing: Active diff --git a/source/index.ts b/source/index.ts index 912fd48..56e0a58 100644 --- a/source/index.ts +++ b/source/index.ts @@ -37,7 +37,7 @@ interface Viewport { hasTouch?: boolean; } -if (/^AWS_Lambda_nodejs(?:10|12|14|16)[.]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'; } @@ -196,7 +196,7 @@ class Chromium { LambdaFS.inflate(`${input}/swiftshader.tar.br`), ]; - if (/^AWS_Lambda_nodejs(?:10|12|14|16)[.]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.inflate(`${input}/aws.tar.br`)); }