Skip to content

Commit

Permalink
removing node 8 and fixing Azure#228
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoeger committed Jan 14, 2020
1 parent f562028 commit 63cb601
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Worker.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.Azure.Functions.NodeJsWorker</id>
<version>1.2.0$version$</version>
<version>2.0.0$version$</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
14 changes: 1 addition & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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'
}
Expand All @@ -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)
Expand All @@ -59,8 +49,6 @@ jobs:
strategy:
maxParallel: 1
matrix:
NODE8:
NODE_VERSION: $(NODE_8)
NODE10:
NODE_VERSION: $(NODE_10)
NODE12:
Expand Down
9 changes: 4 additions & 5 deletions e2e-nightly-cli-azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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:
Expand All @@ -31,7 +30,7 @@ jobs:
maxParallel: 1
matrix:
NODE10:
NODE_VERSION: $(NODE_HIGHER_LTS)
NODE_VERSION: $(NODE_12)
pool:
vmImage: 'vs2017-win2016'
steps:
Expand Down
7 changes: 3 additions & 4 deletions e2e-nightly-site-azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -11,7 +10,7 @@ jobs:
maxParallel: 1
matrix:
NODE10:
NODE_VERSION: $(NODE_HIGHER_LTS)
NODE_VERSION: $(NODE_12)
pool:
vmImage: 'vs2017-win2016'
steps:
Expand Down
7 changes: 0 additions & 7 deletions package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/FunctionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
18 changes: 15 additions & 3 deletions src/WorkerChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -88,15 +93,15 @@ 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"
};
this._eventStream.write({
requestId: requestId,
workerInitResponse: {
result: this.getStatus(),
capabilities : capabilitiesDictionary,
capabilities : workerCapabilities,
}
});
}
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 3 additions & 8 deletions src/nodejsWorker.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion types/public/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/functions",
"version": "1.2.0",
"version": "2.0.0",
"description": "Azure Functions types for Typescript",
"repository": {
"type": "git",
Expand Down

0 comments on commit 63cb601

Please sign in to comment.