Skip to content

Commit

Permalink
Fix Durable Functions preventing orchestrators from completing (#2491)
Browse files Browse the repository at this point in the history
* Keep synchronization context to ensure durable functions can execute where sync context is required by the orchestrator

* Disable CA2007 error

* Update CHANGELOG.md
  • Loading branch information
SeanFeldman authored Jul 18, 2023
1 parent d6d531c commit 7329456
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Fixes baggage propagation when an exception is thrown from middleware ([#2487](https://github.com/getsentry/sentry-dotnet/pull/2487))
- Fix Durable Functions preventing orchestrators from completing ([#2491](https://github.com/getsentry/sentry-dotnet/pull/2491))

### Dependencies

Expand Down
5 changes: 5 additions & 0 deletions src/Sentry.AzureFunctions.Worker/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.cs]

# Reason: Azure Functions worker doesn't set SynchronizationContext but Durable Functions does and required affinity.
# (https://github.com/Azure/azure-functions-dotnet-worker/issues/1520)
dotnet_diagnostic.CA2007.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public SentryFunctionsWorkerMiddleware(IHub hub)

public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
{
var transactionName = await GetHttpTransactionNameAsync(context).ConfigureAwait(false) ?? context.FunctionDefinition.Name;
var transactionName = await GetHttpTransactionNameAsync(context) ?? context.FunctionDefinition.Name;
var transaction = _hub.StartTransaction(transactionName, "function");
Exception? unhandledException = null;

Expand All @@ -35,7 +35,7 @@ public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next

context.CancellationToken.ThrowIfCancellationRequested();

await next(context).ConfigureAwait(false);
await next(context);
}
catch (Exception exception)
{
Expand Down Expand Up @@ -76,7 +76,7 @@ public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next
private static async Task<string?> GetHttpTransactionNameAsync(FunctionContext context)
{
// Get the HTTP request data
var requestData = await context.GetHttpRequestDataAsync().ConfigureAwait(false);
var requestData = await context.GetHttpRequestDataAsync();
if (requestData is null)
{
// not an HTTP trigger
Expand Down

0 comments on commit 7329456

Please sign in to comment.