diff --git a/Worker.nuspec b/Worker.nuspec index 9200df6f..fbde1dc6 100644 --- a/Worker.nuspec +++ b/Worker.nuspec @@ -2,7 +2,7 @@ Microsoft.Azure.Functions.NodeJsWorker - 1.2.0$version$ + 2.0.0$version$ Microsoft Microsoft false diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fd8b53a4..c08dbec2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,5 @@ variables: { - WORKER_VERSION: '1.2.0', - NODE_8: '8.x', + WORKER_VERSION: '2.0.0', NODE_10: '10.x', NODE_12: '12.x' } @@ -14,27 +13,18 @@ jobs: - job: UnitTests strategy: matrix: - UBUNTU_NODE8: - IMAGE_TYPE: 'ubuntu-latest' - NODE_VERSION: $(NODE_8) UBUNTU_NODE10: IMAGE_TYPE: 'ubuntu-latest' NODE_VERSION: $(NODE_10) UBUNTU_NODE12: IMAGE_TYPE: 'ubuntu-latest' NODE_VERSION: $(NODE_12) - WINDOWS_NODE8: - IMAGE_TYPE: 'vs2017-win2016' - NODE_VERSION: $(NODE_8) WINDOWS_NODE10: IMAGE_TYPE: 'vs2017-win2016' NODE_VERSION: $(NODE_10) WINDOWS_NODE12: IMAGE_TYPE: 'vs2017-win2016' NODE_VERSION: $(NODE_12) - MAC_NODE8: - IMAGE_TYPE: 'macos-10.13' - NODE_VERSION: $(NODE_8) MAC_NODE10: IMAGE_TYPE: 'macos-10.13' NODE_VERSION: $(NODE_10) @@ -59,8 +49,6 @@ jobs: strategy: maxParallel: 1 matrix: - NODE8: - NODE_VERSION: $(NODE_8) NODE10: NODE_VERSION: $(NODE_10) NODE12: diff --git a/e2e-nightly-cli-azure-pipelines.yml b/e2e-nightly-cli-azure-pipelines.yml index bd50ce32..34864918 100644 --- a/e2e-nightly-cli-azure-pipelines.yml +++ b/e2e-nightly-cli-azure-pipelines.yml @@ -1,7 +1,6 @@ variables: { - WORKER_VERSION: '1.2.0', - NODE_LOWER_LTS: '8.x', - NODE_HIGHER_LTS: '10.x' + WORKER_VERSION: '2.0.0', + NODE_12: '12.x' } name: $(WORKER_VERSION)-$(Date:yyyyMMdd)$(Rev:.r) @@ -11,7 +10,7 @@ jobs: matrix: WINDOWS_NODE10: IMAGE_TYPE: 'vs2017-win2016' - NODE_VERSION: $(NODE_HIGHER_LTS) + NODE_VERSION: $(NODE_12) pool: vmImage: $(IMAGE_TYPE) steps: @@ -31,7 +30,7 @@ jobs: maxParallel: 1 matrix: NODE10: - NODE_VERSION: $(NODE_HIGHER_LTS) + NODE_VERSION: $(NODE_12) pool: vmImage: 'vs2017-win2016' steps: diff --git a/e2e-nightly-site-azure-pipelines.yml b/e2e-nightly-site-azure-pipelines.yml index 22c5f124..7c855625 100644 --- a/e2e-nightly-site-azure-pipelines.yml +++ b/e2e-nightly-site-azure-pipelines.yml @@ -1,7 +1,6 @@ variables: { - WORKER_VERSION: '1.2.0', - NODE_LOWER_LTS: '8.x', - NODE_HIGHER_LTS: '10.x' + WORKER_VERSION: '2.0.0', + NODE_12: '12.x' } name: $(WORKER_VERSION)-$(Date:yyyyMMdd)$(Rev:.r) @@ -11,7 +10,7 @@ jobs: maxParallel: 1 matrix: NODE10: - NODE_VERSION: $(NODE_HIGHER_LTS) + NODE_VERSION: $(NODE_12) pool: vmImage: 'vs2017-win2016' steps: diff --git a/package.ps1 b/package.ps1 index 353119bf..13c2e9ac 100644 --- a/package.ps1 +++ b/package.ps1 @@ -24,13 +24,6 @@ copy-item ./dist/src/nodejsWorker.js ./pkg/dist/src/ copy-item ./worker.config.json pkg ./node_modules/.bin/webpack StopOnFailedExecution # fail if error -# Node 8 support -./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=8.4.0 --target_platform=win32 -./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=8.4.0 --target_platform=darwin -./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=8.4.0 --target_platform=linux --target_libc=glibc -./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=8.4.0 --target_platform=win32 -./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=8.4.0 --target_platform=darwin -./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=x64 --target=8.4.0 --target_platform=linux --target_libc=glibc # Node 10 support ./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=10.1.0 --target_platform=win32 ./node_modules/.bin/node-pre-gyp install -C pkg/grpc --target_arch=ia32 --target=10.1.0 --target_platform=darwin diff --git a/src/FunctionInfo.ts b/src/FunctionInfo.ts index 6d93181e..0474a61e 100644 --- a/src/FunctionInfo.ts +++ b/src/FunctionInfo.ts @@ -40,7 +40,6 @@ export class FunctionInfo { /** * Return output binding details on the special key "$return" output binding - * Will be used in the future to address bugfix with breaking change: https://github.com/Azure/azure-functions-nodejs-worker/issues/228 */ public getReturnBinding() { return this.outputBindings[returnBindingKey]; diff --git a/src/WorkerChannel.ts b/src/WorkerChannel.ts index 232e8a05..e48cce0a 100644 --- a/src/WorkerChannel.ts +++ b/src/WorkerChannel.ts @@ -34,11 +34,16 @@ export class WorkerChannel implements IWorkerChannel { private _eventStream: IEventStream; private _functionLoader: IFunctionLoader; private _workerId: string; + private _hostVersion: string; + private _hostCapabilities: {[key:string]: string}; constructor(workerId: string, eventStream: IEventStream, functionLoader: IFunctionLoader) { this._workerId = workerId; this._eventStream = eventStream; this._functionLoader = functionLoader; + // default value + this._hostVersion = "3.0"; + this._hostCapabilities = {}; // call the method with the matching 'event' name on this class, passing the requestId and event message eventStream.on('data', (msg) => { @@ -88,7 +93,7 @@ export class WorkerChannel implements IWorkerChannel { * @param msg gRPC message content */ public workerInitRequest(requestId: string, msg: rpc.WorkerInitRequest) { - const capabilitiesDictionary = { + const workerCapabilities = { RpcHttpTriggerMetadataRemoved: "true", RpcHttpBodyOnly: "true" }; @@ -96,7 +101,7 @@ export class WorkerChannel implements IWorkerChannel { requestId: requestId, workerInitResponse: { result: this.getStatus(), - capabilities : capabilitiesDictionary, + capabilities : workerCapabilities, } }); } @@ -161,7 +166,14 @@ export class WorkerChannel implements IWorkerChannel { try { if (result) { if (result.return) { - response.returnValue = toTypedData(result.return); + // TODO: add capability from host to go to "non-breaking" mode + if (this._hostVersion === "2.0") + { + response.returnValue = toTypedData(result.return); + } else { + let returnBinding = info.getReturnBinding(); + response.returnValue = returnBinding ? returnBinding.converter(result.return) : toTypedData(result.return); + } } if (result.bindings) { response.outputData = Object.keys(info.outputBindings) diff --git a/src/nodejsWorker.ts b/src/nodejsWorker.ts index ad6e7c38..bdcdff08 100644 --- a/src/nodejsWorker.ts +++ b/src/nodejsWorker.ts @@ -1,7 +1,7 @@ var logPrefix = "LanguageWorkerConsoleLog"; var errorPrefix = logPrefix + "[error] "; var warnPrefix = logPrefix + "[warn] "; -var supportedVersions:string[] = ["v8","v10", "v12"]; +var supportedVersions:string[] = ["v10", "v12"]; var worker; // Try validating node version @@ -19,13 +19,8 @@ function validateNodeVersion(version) { } else if (supportedVersions.indexOf(major) < 0) { message = "Incompatible Node.js version. The version you are using is " + version + - ", 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. " - + "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)."; - } - // Log a warning that v12 is not fully supported - if (major === "v12") - { - 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."); + ", but the runtime requires an LTS-covered major version. LTS-covered versions have an even major version number (10.x, 12.x, etc.) as per https://github.com/nodejs/Release#release-plan. " + + "For deployed code, change WEBSITE_NODE_DEFAULT_VERSION to '~12' 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)."; } // Unknown error diff --git a/types/public/package.json b/types/public/package.json index 8667160d..7e099632 100644 --- a/types/public/package.json +++ b/types/public/package.json @@ -1,6 +1,6 @@ { "name": "@azure/functions", - "version": "1.2.0", + "version": "2.0.0", "description": "Azure Functions types for Typescript", "repository": { "type": "git",