Skip to content

Commit 98bfb92

Browse files
authored
Fix bug for durable when returning value without a binding set (#60)
1 parent c67b63a commit 98bfb92

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/functions",
3-
"version": "4.0.0-alpha.7",
3+
"version": "4.0.0-alpha.8",
44
"description": "Microsoft Azure Functions NodeJS Framework",
55
"keywords": [
66
"azure",

src/InvocationModel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ export class InvocationModel implements coreTypes.InvocationModel {
9292
const response: RpcInvocationResponse = { invocationId: this.#coreCtx.invocationId };
9393

9494
response.outputData = [];
95+
let usedReturnValue = false;
9596
for (const [name, binding] of Object.entries(this.#bindings)) {
9697
if (binding.direction === 'out') {
9798
if (name === returnBindingKey) {
9899
response.returnValue = await this.#convertOutput(binding, result);
100+
usedReturnValue = true;
99101
} else {
100102
response.outputData.push({
101103
name,
@@ -109,7 +111,7 @@ export class InvocationModel implements coreTypes.InvocationModel {
109111
// to the host, even if no explicit output binding is set. In most cases, this is ignored,
110112
// but e.g., Durable uses this to pass orchestrator state back to the Durable extension, w/o
111113
// an explicit output binding. See here for more details: https://github.com/Azure/azure-functions-nodejs-library/pull/25
112-
if (!response.returnValue && response.outputData.length == 0 && !isHttpTrigger(this.#triggerType)) {
114+
if (!usedReturnValue && !isHttpTrigger(this.#triggerType)) {
113115
response.returnValue = toRpcTypedData(result);
114116
}
115117

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
export const version = '4.0.0-alpha.7';
4+
export const version = '4.0.0-alpha.8';
55

66
export const returnBindingKey = '$return';

0 commit comments

Comments
 (0)