Skip to content

Commit 4a4a784

Browse files
authored
Unblock Node.js v12 with appropriate warning (Azure#255)
* Unblock Node.js v12 with appropriate warning * add test * adding e2e test too * updating to 1.2.0 * Workaround to protobuf.js issue
1 parent 99a12a4 commit 4a4a784

9 files changed

+49
-20
lines changed

Worker.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>Microsoft.Azure.Functions.NodeJsWorker</id>
5-
<version>1.1.1$version$</version>
5+
<version>1.2.0$version$</version>
66
<authors>Microsoft</authors>
77
<owners>Microsoft</owners>
88
<requireLicenseAcceptance>false</requireLicenseAcceptance>

azure-pipelines.yml

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
variables: {
2-
WORKER_VERSION: '1.1.1',
3-
NODE_LOWER_LTS: '8.x',
4-
NODE_HIGHER_LTS: '10.x'
2+
WORKER_VERSION: '1.2.0',
3+
NODE_8: '8.x',
4+
NODE_10: '10.x',
5+
NODE_12: '12.x'
56
}
67
name: $(WORKER_VERSION)-$(Date:yyyyMMdd)$(Rev:.r)
78

@@ -15,22 +16,31 @@ jobs:
1516
matrix:
1617
UBUNTU_NODE8:
1718
IMAGE_TYPE: 'ubuntu-latest'
18-
NODE_VERSION: $(NODE_LOWER_LTS)
19+
NODE_VERSION: $(NODE_8)
1920
UBUNTU_NODE10:
2021
IMAGE_TYPE: 'ubuntu-latest'
21-
NODE_VERSION: $(NODE_HIGHER_LTS)
22+
NODE_VERSION: $(NODE_10)
23+
UBUNTU_NODE12:
24+
IMAGE_TYPE: 'ubuntu-latest'
25+
NODE_VERSION: $(NODE_12)
2226
WINDOWS_NODE8:
2327
IMAGE_TYPE: 'vs2017-win2016'
24-
NODE_VERSION: $(NODE_LOWER_LTS)
28+
NODE_VERSION: $(NODE_8)
2529
WINDOWS_NODE10:
2630
IMAGE_TYPE: 'vs2017-win2016'
27-
NODE_VERSION: $(NODE_HIGHER_LTS)
31+
NODE_VERSION: $(NODE_10)
32+
WINDOWS_NODE12:
33+
IMAGE_TYPE: 'vs2017-win2016'
34+
NODE_VERSION: $(NODE_12)
2835
MAC_NODE8:
2936
IMAGE_TYPE: 'macos-10.13'
30-
NODE_VERSION: $(NODE_LOWER_LTS)
37+
NODE_VERSION: $(NODE_8)
3138
MAC_NODE10:
3239
IMAGE_TYPE: 'macos-10.13'
33-
NODE_VERSION: $(NODE_HIGHER_LTS)
40+
NODE_VERSION: $(NODE_10)
41+
MAC_NODE12:
42+
IMAGE_TYPE: 'macos-10.13'
43+
NODE_VERSION: $(NODE_12)
3444
pool:
3545
vmImage: $(IMAGE_TYPE)
3646
steps:
@@ -50,9 +60,11 @@ jobs:
5060
maxParallel: 1
5161
matrix:
5262
NODE8:
53-
NODE_VERSION: $(NODE_LOWER_LTS)
63+
NODE_VERSION: $(NODE_8)
5464
NODE10:
55-
NODE_VERSION: $(NODE_HIGHER_LTS)
65+
NODE_VERSION: $(NODE_10)
66+
NODE12:
67+
NODE_VERSION: $(NODE_12)
5668
pool:
5769
vmImage: 'vs2017-win2016'
5870
steps:
@@ -83,7 +95,7 @@ jobs:
8395
steps:
8496
- task: NodeTool@0
8597
inputs:
86-
versionSpec: $(NODE_HIGHER_LTS)
98+
versionSpec: $(NODE_10)
8799
displayName: 'Install Node.js for test'
88100
- powershell: .\package.ps1
89101
- task: NuGetCommand@2

e2e-nightly-cli-azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables: {
2-
WORKER_VERSION: '1.1.1',
2+
WORKER_VERSION: '1.2.0',
33
NODE_LOWER_LTS: '8.x',
44
NODE_HIGHER_LTS: '10.x'
55
}

e2e-nightly-site-azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables: {
2-
WORKER_VERSION: '1.1.1',
2+
WORKER_VERSION: '1.2.0',
33
NODE_LOWER_LTS: '8.x',
44
NODE_HIGHER_LTS: '10.x'
55
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-functions-nodejs-worker",
33
"author": "Microsoft Corporation",
4-
"version": "1.1.1",
4+
"version": "1.2.0",
55
"description": "Microsoft Azure Functions NodeJS Worker",
66
"license": "(MIT OR Apache-2.0)",
77
"dependencies": {

package.ps1

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ StopOnFailedExecution # fail if error
3838
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=10.1.0 --target_platform=win32
3939
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=10.1.0 --target_platform=darwin
4040
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=10.1.0 --target_platform=linux --target_libc=glibc
41+
# Node 12 support
42+
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=12.13.0 --target_platform=win32
43+
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=12.13.0 --target_platform=darwin
44+
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=12.13.0 --target_platform=linux --target_libc=glibc
45+
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=12.13.0 --target_platform=win32
46+
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=12.13.0 --target_platform=darwin
47+
./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=12.13.0 --target_platform=linux --target_libc=glibc
4148
copy-item Worker.nuspec pkg/
4249

4350
if ($NugetPack)

scripts/generateProtos.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ async function generateProtos() {
2020
genJs(allFiles)
2121
.then(data => console.log("Compiled to JavaScript."))
2222
.catch(err => console.log(`Could not compile to JavaScript: ${err}`));
23-
24-
genTs(allFiles)
23+
24+
// Don't generate with Node.js v12 until resolved: https://github.com/protobufjs/protobuf.js/issues/1275
25+
if (!process.version.startsWith("v12")) {
26+
genTs(allFiles)
2527
.then(data => console.log("Compiled to TypeScript."))
2628
.catch(err => console.log(`Could not compile to TypeScript: ${err}`));
29+
}
2730
};
2831

2932
async function getFiles(root, fileFilter, directoryFilter) {

src/nodejsWorker.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var logPrefix = "LanguageWorkerConsoleLog";
22
var errorPrefix = logPrefix + "[error] ";
3-
var supportedVersions:string[] = ["v8","v10"];
3+
var warnPrefix = logPrefix + "[warn] ";
4+
var supportedVersions:string[] = ["v8","v10", "v12"];
45
var worker;
56

67
// Try validating node version
@@ -21,6 +22,12 @@ function validateNodeVersion(version) {
2122
", but the runtime requires an LTS-covered major version. LTS-covered versions have an even major version number (8.x, 10.x, etc.) as per https://github.com/nodejs/Release#release-plan. "
2223
+ "For deployed code, change WEBSITE_NODE_DEFAULT_VERSION to '~10' in App Settings. Locally, install or switch to a supported node version (make sure to quit and restart your code editor to pick up the changes).";
2324
}
25+
// Log a warning that v12 is not fully supported
26+
if (major === "v12")
27+
{
28+
console.warn(warnPrefix + "The Node.js version you are using (" + version + ") is not fully supported by Azure Functions V2. We recommend using one the following major versions: 8, 10.");
29+
}
30+
2431
// Unknown error
2532
} catch(err) {
2633
var unknownError = "Error in validating Node.js version. ";

types/public/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/functions",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "Azure Functions types for Typescript",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)