-
Notifications
You must be signed in to change notification settings - Fork 44
Serialize falsy values for Durable Functions #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0ec625a
4206fc2
a153bae
38fe7bb
4811a97
7697e23
04c26a0
4e6c470
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,11 +227,18 @@ export class WorkerChannel implements IWorkerChannel { | |
// explicitly set outputData to empty array to concat later | ||
response.outputData = []; | ||
|
||
// As legacy behavior, falsy values get serialized to `null` in AzFunctions. | ||
// This breaks Durable Functions expectations, where customers expect any | ||
// JSON-serializable values to be preserved by the framework, | ||
// so we check if we're serializing for durable and, if so, ensure falsy | ||
// values get serialized. | ||
let isDurableBinding = info?.bindings?.name?.type == 'activityTrigger'; | ||
|
||
try { | ||
if (result) { | ||
if (result || (isDurableBinding && result != null)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's correct, in durable bindings such as I've also expanded my comments in the PR to make this clearer :) Please let me know if there's anything else I can clarify! As for serializing |
||
let returnBinding = info.getReturnBinding(); | ||
// Set results from return / context.done | ||
if (result.return) { | ||
if (result.return || (isDurableBinding && result.return != null)) { | ||
if (this._v1WorkerBehavior) { | ||
response.returnValue = toTypedData(result.return); | ||
} else { | ||
|
Uh oh!
There was an error while loading. Please reload this page.