Skip to content
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

Lease encountered an unhandled user exception during processing and cosmosdbtrigger invocations failing #892

Open
Barsonax opened this issue May 29, 2024 · 3 comments

Comments

@Barsonax
Copy link

Barsonax commented May 29, 2024

Repro steps

Seems to happen randomly when using CosmosDbTriggers. When it happens it usually happens in a burst of warnings

Expected behavior

The cosmosdbtrigger invocation should work without errors.

Actual behavior

A 'Lease 0 encountered an unhandled user exception during processing.' warning is logged and the cosmosdbtrigger invocation fails.

Known workarounds

No workarounds that I know of

Related information

image

  • SDK Azurefunctions: 4.34.1.1
  • Nuget Microsoft.Azure.Cosmos 3.39.1
  • Links to source (private, cant share)
@ealsur
Copy link
Member

ealsur commented Jun 12, 2024

This log means your Function code had an unhandled error. Look at the Exception property and that should tell you the error that happened during execution.

This error is happening after the Trigger received the events and sent them to your Function code for execution.

@Barsonax
Copy link
Author

There is no exception property so that makes it hard to find out the cause of this. Should there be an exception property normally?

I do see this behavior happening from multiple cosmosdb triggers at the same time. I don't see any logging from my own code so I think it does not even enter my code but already errors before that.

Maybe implementing my own middleware to catch the error and log it would give me more information

@ealsur
Copy link
Member

ealsur commented Jun 13, 2024

The extension emits the event with the Exception property populated:

this.logger.LogWarning(Events.OnError, userException.InnerException, "Lease {LeaseToken} encountered an unhandled user exception during processing.", leaseToken);

It could be that Application Insights is storing them on the exceptions table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants