Merge pull request #22 from Sparticuz/fix/node18

This commit is contained in:
Kyle McNally 2022-11-28 14:10:26 -05:00 committed by GitHub
commit 1483601cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 18.x
- name: Install Packages - name: Install Packages
run: npm install run: npm install
@ -42,6 +42,7 @@ jobs:
version: version:
- 14 - 14
- 16 - 16
- 18
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@ -37,3 +37,14 @@ Resources:
- AWSLambdaBasicExecutionRole - AWSLambdaBasicExecutionRole
- AWSXRayDaemonWriteAccess - AWSXRayDaemonWriteAccess
Tracing: Active Tracing: Active
node18:
Type: AWS::Serverless::Function
Properties:
Layers:
- !Ref layer
Handler: handlers/index.handler
Runtime: nodejs18.x
Policies:
- AWSLambdaBasicExecutionRole
- AWSXRayDaemonWriteAccess
Tracing: Active

View File

@ -37,7 +37,7 @@ interface Viewport {
hasTouch?: boolean; 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) { if (process.env.FONTCONFIG_PATH === undefined) {
process.env.FONTCONFIG_PATH = '/tmp/aws'; process.env.FONTCONFIG_PATH = '/tmp/aws';
} }
@ -196,7 +196,7 @@ class Chromium {
LambdaFS.inflate(`${input}/swiftshader.tar.br`), 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`)); promises.push(LambdaFS.inflate(`${input}/aws.tar.br`));
} }