From 572d98a8b13aefd5c03b00d112e68f87cce404dc Mon Sep 17 00:00:00 2001 From: Felix Haus Date: Fri, 20 May 2022 21:35:01 +0200 Subject: [PATCH 1/2] Updates Lambda runtime to nodejs16.x --- .github/workflows/CI.yml | 36 +++++++++++++++++------------------ .github/workflows/lint.yml | 14 ++++++-------- .github/workflows/release.yml | 2 +- buildimage.Dockerfile | 2 +- main.tf | 2 +- package.json | 6 +++--- test/e2e.test.ts | 2 +- tsconfig.json | 2 +- versions.tf | 2 +- yarn.lock | 28 +++++++++++++-------------- 10 files changed, 46 insertions(+), 50 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 650060e..1d0e8ba 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,15 +9,15 @@ on: jobs: build: runs-on: ubuntu-latest - container: public.ecr.aws/sam/build-nodejs14.x:latest + container: public.ecr.aws/sam/build-nodejs16.x:latest steps: - name: Install yarn - run: npm install --global yarn@1.22.17 + run: npm install --global yarn@1.22.18 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | .yarn @@ -30,7 +30,7 @@ jobs: yarn workspace @millihq/tf-next-image-optimization build - name: Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: lambda path: | @@ -40,7 +40,7 @@ jobs: test-integration: runs-on: ubuntu-latest - container: public.ecr.aws/sam/build-nodejs14.x:latest + container: public.ecr.aws/sam/build-nodejs16.x:latest services: s3: @@ -51,12 +51,12 @@ jobs: steps: - name: Install yarn - run: npm install --global yarn@1.22.17 + run: npm install --global yarn@1.22.18 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | .yarn @@ -93,15 +93,13 @@ jobs: brew install aws-sam-cli sam --version - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Cache - uses: actions/cache@v2 + - name: Setup node + uses: actions/setup-node@v3 with: - path: | - .yarn - **/node_modules - key: e2e-${{ hashFiles('yarn.lock') }} + node-version: '16' + cache: 'yarn' - name: Install dependencies run: yarn install --frozen-lockfile --check-files @@ -131,16 +129,16 @@ jobs: run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '16' cache: 'yarn' - name: Install dependencies run: yarn --frozen-lockfile - name: Download build artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: lambda path: lib diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9bbbaac..f2a4355 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,15 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Cache - uses: actions/cache@v2 + - name: Setup node + uses: actions/setup-node@v3 with: - path: | - .yarn - **/node_modules - key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} + node-version: '16' + cache: 'yarn' - name: Install Dependencies run: yarn --frozen-lockfile --cache-folder .yarn @@ -37,7 +35,7 @@ jobs: container: hashicorp/terraform steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Lint Terraform run: terraform fmt -check -recursive -diff diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb97a67..9f26744 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: # Do a full checkout (all branches) - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/buildimage.Dockerfile b/buildimage.Dockerfile index 102640c..0c65a96 100644 --- a/buildimage.Dockerfile +++ b/buildimage.Dockerfile @@ -2,7 +2,7 @@ # Since it is intended to run on Amazon Linux we need to install binaries # for the internally used sharp package that match this distribution -FROM amazon/aws-sam-cli-emulation-image-nodejs14.x +FROM amazon/aws-sam-cli-emulation-image-nodejs16.x # Install yarn RUN npm i -g yarn diff --git a/main.tf b/main.tf index 0b65598..a67f128 100644 --- a/main.tf +++ b/main.tf @@ -20,7 +20,7 @@ module "image_optimizer" { function_name = var.deployment_name description = "Managed by Terraform Next.js image optimizer" handler = "handler.handler" - runtime = "nodejs14.x" + runtime = "nodejs16.x" memory_size = var.lambda_memory_size timeout = var.lambda_timeout publish = true diff --git a/package.json b/package.json index 7b7a658..5ec27da 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,10 @@ "release:ci": "release-it --no-increment --no-git.push --ci" }, "devDependencies": { - "@millihq/sammy": "^2.0.1", + "@millihq/sammy": "^3.0.0", "@ofhouse/keep-a-changelog": "2.3.0-no-increment-fix", "@release-it/bumper": "^3.0.1", - "@tsconfig/node14": "^1.0.1", + "@tsconfig/node16": "^1.0.2", "@types/jest": "^27.0.1", "@types/mime-types": "^2.1.1", "@types/node": "^14.0.0", @@ -47,7 +47,7 @@ "typescript": "^4.6.3" }, "resolutions": { - "aws-sdk": "2.1001.0" + "aws-sdk": "2.1055.0" }, "release-it": { "git": { diff --git a/test/e2e.test.ts b/test/e2e.test.ts index 8e224ec..afb723a 100644 --- a/test/e2e.test.ts +++ b/test/e2e.test.ts @@ -8,7 +8,7 @@ import { extension as extensionMimeType } from 'mime-types'; import { s3PublicDir } from './utils/s3-public-dir'; import { getLocalIpAddressFromHost } from './utils/host-ip-address'; -const NODE_RUNTIME = 'nodejs14.x'; +const NODE_RUNTIME = 'nodejs16.x'; // Environment variables that should be set in the Lambda environment const ENVIRONMENT_VARIABLES = { NODE_ENV: 'production', diff --git a/tsconfig.json b/tsconfig.json index b082851..e9c0baf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "@tsconfig/node14/tsconfig.json" + "extends": "@tsconfig/node16/tsconfig.json" } diff --git a/versions.tf b/versions.tf index 76a08cd..5b7aa99 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.8" + version = ">= 4.15.0" } } } diff --git a/yarn.lock b/yarn.lock index 948520b..60ea438 100644 --- a/yarn.lock +++ b/yarn.lock @@ -782,15 +782,15 @@ dependencies: node-fetch "^2.0.0" -"@millihq/sammy@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@millihq/sammy/-/sammy-2.0.1.tgz#3200fbdb58449fd50d5df394dd9f21741650af77" - integrity sha512-6j76MsB5cKWJrlRD4D2bGeI74N1IzeM5PJS4HJWHkZmnhVgkbMxuDOazyS+A0ps8+m8HQ+Wa3n8li5iVGcbjNQ== +"@millihq/sammy@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@millihq/sammy/-/sammy-3.0.0.tgz#23030fc8168b440781af82777fd3a982993a87cf" + integrity sha512-uYq80ADPvkritON12svv9lIFjaKMH59yyYcdAYIvdQNHjMuH8VY/aGAVKoq3eJrjyG6bm1Ngq+K10CIWLlMHbQ== dependencies: - aws-sdk "^2.804.0" + aws-sdk "^2.1055.0" change-case "^4.1.2" get-port "^5.1.1" - node-fetch "^2.6.1" + node-fetch "^2.6.7" tmp "^0.2.1" unzipper "^0.10.11" yaml "^1.10.0" @@ -1048,10 +1048,10 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== -"@tsconfig/node14@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" - integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== +"@tsconfig/node16@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== "@types/aws-lambda@8.10.56": version "8.10.56" @@ -1594,10 +1594,10 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -aws-sdk@*, aws-sdk@2.1001.0, aws-sdk@^2.804.0: - version "2.1001.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1001.0.tgz#c4da256aa0058438ba611ae06fa850f4f7d63abc" - integrity sha512-DpmslPU8myCaaRUwMzB/SqAMtD2zQckxYwq3CguIv8BI+JHxDLeTdPCLfA5jffQ8k6dcvISOuiqdpwCZucU0BA== +aws-sdk@*, aws-sdk@2.1055.0, aws-sdk@^2.1055.0: + version "2.1055.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1055.0.tgz#07beb86650d5a313f7c899807c51b12b5e2f4117" + integrity sha512-99drH3mvXakw9we8Rs2cDQmi2pS7PVAC9pvTlB7lHPUwLYftMlko5cFMceZxvTHeyLkdvg98iNIHI3hbnzitoQ== dependencies: buffer "4.9.2" events "1.1.1" From 7af016c276b2365f74f8c362113b985da58934b5 Mon Sep 17 00:00:00 2001 From: Felix Haus Date: Fri, 20 May 2022 21:43:29 +0200 Subject: [PATCH 2/2] Update typescript package --- lib/package.json | 2 +- package.json | 2 +- yarn.lock | 13 ++++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/package.json b/lib/package.json index ec19148..cbd17ca 100644 --- a/lib/package.json +++ b/lib/package.json @@ -29,7 +29,7 @@ "@types/react": "^17.0.3", "@types/react-dom": "^17.0.3", "glob": "^7.1.6", - "typescript": "^4.1.3" + "typescript": "^4.6.4" }, "files": [ "dist.zip", diff --git a/package.json b/package.json index 5ec27da..ebb9e25 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "release-it": "^14.12.3", "release-it-yarn-workspaces": "^2.0.1", "ts-jest": "^27.0.5", - "typescript": "^4.6.3" + "typescript": "^4.6.4" }, "resolutions": { "aws-sdk": "2.1055.0" diff --git a/yarn.lock b/yarn.lock index 60ea438..1ee57e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6301,15 +6301,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@^4.1.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" - integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== - -typescript@^4.6.3: - version "4.6.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c" - integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== +typescript@^4.6.4: + version "4.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" + integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== unbox-primitive@^1.0.0, unbox-primitive@^1.0.1: version "1.0.1"