diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 298a5428fd..21bdc3b269 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3.5.3 - uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 - run: npm install - run: npm run lint docs: diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index 649a163cab..f055ddf7a7 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -12,7 +12,7 @@ build_file: "nodejs-docs-samples/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user" } # Export XUnit test results for further analysis @@ -20,4 +20,4 @@ action { define_artifacts { regex: "**/*sponge_log.xml" } -} \ No newline at end of file +} diff --git a/.kokoro/functions/billing-periodic.cfg b/.kokoro/functions/billing-periodic.cfg index 63b72d1571..e1e9ec23c4 100644 --- a/.kokoro/functions/billing-periodic.cfg +++ b/.kokoro/functions/billing-periodic.cfg @@ -15,7 +15,7 @@ env_vars: { # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user" } # Tell the trampoline which build file to use. diff --git a/.kokoro/functions/imagemagick.cfg b/.kokoro/functions/imagemagick.cfg index 801e160cdf..02c044aeb6 100644 --- a/.kokoro/functions/imagemagick.cfg +++ b/.kokoro/functions/imagemagick.cfg @@ -9,7 +9,7 @@ env_vars: { # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user" } # Tell the trampoline which build file to use. diff --git a/.kokoro/functions/ocr-app.cfg b/.kokoro/functions/ocr-app.cfg index db77c999d5..a172723876 100644 --- a/.kokoro/functions/ocr-app.cfg +++ b/.kokoro/functions/ocr-app.cfg @@ -9,7 +9,7 @@ env_vars: { # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user" } # Tell the trampoline which build file to use. diff --git a/.kokoro/run/common.cfg b/.kokoro/run/common.cfg index 0bfb0d1dc1..10f6694963 100644 --- a/.kokoro/run/common.cfg +++ b/.kokoro/run/common.cfg @@ -18,7 +18,7 @@ env_vars: { # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user" } # Export XUnit test results for further analysis diff --git a/cloud-sql/mysql/mysql2/package.json b/cloud-sql/mysql/mysql2/package.json index ac2e432a41..72e3a08df7 100644 --- a/cloud-sql/mysql/mysql2/package.json +++ b/cloud-sql/mysql/mysql2/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "scripts": { "start": "node server/server.js", diff --git a/cloud-tasks/snippets/package.json b/cloud-tasks/snippets/package.json index 1a24617826..8a5c10dde4 100644 --- a/cloud-tasks/snippets/package.json +++ b/cloud-tasks/snippets/package.json @@ -5,7 +5,7 @@ "author": "Google Inc.", "private": true, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "files": [ "*.js" diff --git a/functions/imagemagick/test/index.test.js b/functions/imagemagick/test/index.test.js index 5aa3b10e17..f2fef74257 100644 --- a/functions/imagemagick/test/index.test.js +++ b/functions/imagemagick/test/index.test.js @@ -1,4 +1,4 @@ -// Copyright 2017 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -80,45 +80,64 @@ describe('functions/imagemagick tests', () => { const PORT = 8080; const {ffProc, ffProcHandler} = await startFF(PORT); - await request({ - url: `http://localhost:${PORT}/blurOffensiveImages`, - method: 'POST', - data: { + try { + await request({ + url: `http://localhost:${PORT}/blurOffensiveImages`, + method: 'POST', data: { - bucket: BUCKET_NAME, - name: testFiles.safe, + data: { + bucket: BUCKET_NAME, + name: testFiles.safe, + }, }, - }, - }); + }); + } catch(error) { + assert.fail(error); + } + ffProc.kill(); - const stdout = await ffProcHandler; - assert.ok(stdout.includes(`Detected ${testFiles.safe} as OK.`)); + + try { + const stdout = await ffProcHandler; + assert.ok(stdout.includes(`Detected ${testFiles.safe} as OK.`)); + } catch(error) { + assert.fail(error); + } }); it('blurOffensiveImages successfully blurs offensive images', async () => { const PORT = 8081; const {ffProc, ffProcHandler} = await startFF(PORT); - await request({ - url: `http://localhost:${PORT}/blurOffensiveImages`, - method: 'POST', - data: { + try { + await request({ + url: `http://localhost:${PORT}/blurOffensiveImages`, + method: 'POST', data: { - bucket: BUCKET_NAME, - name: testFiles.offensive, + data: { + bucket: BUCKET_NAME, + name: testFiles.offensive, + }, }, - }, - }); + }); + } catch(error) { + assert.fail(error); + } ffProc.kill(); - const stdout = await ffProcHandler; - - assert.ok(stdout.includes(`Blurred image: ${testFiles.offensive}`)); - assert.ok( - stdout.includes( - `Uploaded blurred image to: gs://${BLURRED_BUCKET_NAME}/${testFiles.offensive}` - ) - ); + + try { + const stdout = await ffProcHandler; + + assert.ok(stdout.includes(`Blurred image: ${testFiles.offensive}`)); + assert.ok( + stdout.includes( + `Uploaded blurred image to: gs://${BLURRED_BUCKET_NAME}/${testFiles.offensive}` + ) + ); + } catch(error) { + assert.fail(error); + } const exists = await storage .bucket(BLURRED_BUCKET_NAME) @@ -132,20 +151,29 @@ describe('functions/imagemagick tests', () => { const {ffProc, ffProcHandler} = await startFF(PORT); const missingFileName = 'file-does-not-exist.jpg'; - await request({ - url: `http://localhost:${PORT}/blurOffensiveImages`, - method: 'POST', - data: { + try { + await request({ + url: `http://localhost:${PORT}/blurOffensiveImages`, + method: 'POST', data: { - bucket: BUCKET_NAME, - name: missingFileName, + data: { + bucket: BUCKET_NAME, + name: missingFileName, + }, }, - }, - }); + }); + } catch(error) { + assert.fail(error); + } ffProc.kill(); - const stdout = await ffProcHandler; - assert.ok(stdout.includes(`Detected ${missingFileName} as OK.`)); + + try { + const stdout = await ffProcHandler; + assert.ok(stdout.includes(`Detected ${missingFileName} as OK.`)); + } catch(error) { + assert.fail(error); + } }); }); diff --git a/package.json b/package.json index 691ade290b..3f78668fb3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google Inc.", "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "repository": { "type": "git", diff --git a/renovate.json b/renovate.json index aacf68869d..eaf60ec986 100644 --- a/renovate.json +++ b/renovate.json @@ -7,7 +7,7 @@ "rebaseStalePrs": false, "force": { "constraints": { - "node": "< 15.0.0" + "node": ">= 16.0.0" } } } diff --git a/run/idp-sql/Dockerfile b/run/idp-sql/Dockerfile index 66fa0403f2..523a8c94c2 100644 --- a/run/idp-sql/Dockerfile +++ b/run/idp-sql/Dockerfile @@ -4,7 +4,7 @@ # Use the official lightweight Node.js image. # https://hub.docker.com/_/node -FROM node:14-slim +FROM node:16-slim # Create and change to the app directory. WORKDIR /usr/src/app diff --git a/run/idp-sql/package.json b/run/idp-sql/package.json index 393059255e..f48313ea02 100644 --- a/run/idp-sql/package.json +++ b/run/idp-sql/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=12.0.0" + "node": ">=16.0.0" }, "scripts": { "start": "node index.js", diff --git a/run/websockets/package.json b/run/websockets/package.json index e63c42b3db..0f10a14564 100644 --- a/run/websockets/package.json +++ b/run/websockets/package.json @@ -5,6 +5,9 @@ "private": true, "license": "Apache Version 2.0", "author": "Google LLC", + "engines": { + "node": ">=16.x.x" + }, "scripts": { "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 0", diff --git a/workflows/invoke-private-endpoint/package.json b/workflows/invoke-private-endpoint/package.json index c9190955f4..881991ce91 100644 --- a/workflows/invoke-private-endpoint/package.json +++ b/workflows/invoke-private-endpoint/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "scripts": { "start": "node app.js", diff --git a/workflows/package.json b/workflows/package.json index a078e7c4d5..97eb2a64f5 100644 --- a/workflows/package.json +++ b/workflows/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=12.0.0" + "node": ">=16.0.0" }, "scripts": { "build": "tsc -p .",