Repository navigation
Improve error message for manual orchestrator and entity function invocation - #3302
Conversation
…ocation Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the developer/user experience when an orchestrator or entity function is manually invoked (e.g., via the Azure Portal “Run” button) by replacing a cryptic binding conversion failure with a clearer exception and actionable guidance.
Changes:
- Updated orchestrator trigger binding to throw a friendlier exception/message when the trigger input isn’t a valid orchestration context.
- Updated entity trigger binding to throw a similar friendlier exception/message for consistency.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/WebJobs.Extensions.DurableTask/Bindings/OrchestrationTriggerAttributeBindingProvider.cs | Replaces the generic “unknown bind” exception with a direct-invocation guidance message for orchestrator trigger binding. |
| src/WebJobs.Extensions.DurableTask/Bindings/EntityTriggerAttributeBindingProvider.cs | Applies the same style of direct-invocation guidance message for entity trigger binding. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 620c8b07-1ed8-4070-ab0a-83a07d40580a
|
Azure Pipelines build 299636 was retried after three infrastructure failures. The retry cleared both Windows failures ( The remaining Linux Equivalent validation for commit
|
|
Superseding the earlier infrastructure-failure note: official Azure Pipelines build 300022 validated the current PR merge commit and passed the complete 28-job matrix, including |
Treat omitted Admin API input as direct invocation for orchestrator and entity triggers, and cover the real Core Tools endpoint behavior with E2E tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Official Azure Pipelines build 300135 now validates the current PR merge commit The first |
Remove unreachable null fallbacks after direct invocation values have already been handled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bbfc6f4b-dec2-4d30-ace8-be903cca5b88
| throw new ArgumentException($"Don't know how to bind to {value?.GetType().Name ?? "null"}.", nameof(value)); | ||
| throw new InvalidOperationException( | ||
| "Durable entity functions do not support direct invocation. " + | ||
| "Signal an entity from a client or orchestrator function by using a Durable client."); |
andystaples
left a comment
There was a problem hiding this comment.
Approved, though the copilot nit is technically correct I'm not going to block on it
Summary
What changed?
InvalidOperationExceptionwhen the Portal/Admin API directly invokes an orchestrator or entity trigger.{"input":""}arrives as a serialized string, while{}arrives as anulltrigger value.ArgumentException, including the actual type, for other unsupported trigger values.Why is this change needed?
Manually invoking an orchestrator or entity function from the Azure Portal currently produces a binding conversion error that does not explain that these durable function types must be scheduled through a Durable client.
The host-side binding is shared by in-process and out-of-process execution. The guidance therefore avoids model-specific APIs such as
StartNewAsync. Portal/Admin API invocation is detected from the actual host values: a serialized string wheninputis present andnullwhen it is omitted. Other unexpected host/runtime values still report their concrete type.Issues / work items
Project checklist
WebJobs.Extensions.DurableTaskpackageEventSourcelogsv2.xbranchAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
TriggerBindingProviderTests.cs,HttpHelpers.cs, andDirectInvocationTests.csAI verification (required if AI was used):
Testing
Automated tests
Targeted trigger-binding tests:
Passed on
net8.0andnet10.0: 6/6 tests on each target, with no build or analyzer warnings.Full FunctionsV2 non-E2E test suite previously passed on both targets: 422/422 tests on
net8.0and 422/422 tests onnet10.0.The dotnet-isolated E2E app build succeeded:
DirectInvocationTeststhen passed 4/4 against a real Core Tools host in about 18 seconds. The test posts to/admin/functions/{functionName}and verifies host logs for:HelloCitieswith{"input":""}HelloCitieswith{}(the omitted-input-to-nullgap)Counterwith{"input":""}Counterwith{}(the omitted-input-to-nullgap)The Core Tools host was cleaned up after the run.
Official Azure Pipelines build 300135 validated the current PR merge commit
e216e820:.NET isolated Net10smoke attempt hit the pipeline's shared-output race (Microsoft.Azure.Functions.Worker.Extensions.DurableTask.deps.jsonwas locked while the agent disk was 96.73% full). Retrying only that failed job passed with no source changes.Manual validation (only if runtime/behavior changed)
Covered by the real Core Tools/Admin API E2E validation above.
Notes for reviewers
Activity functions are intentionally excluded.
ActivityTriggerAttributeBindingProvidersupports Portal/Admin string input, and the existingCallActivity_Like_From_Azure_PortalE2E test covers that behavior.