apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Azure Functions: Report failed requests in Application Insights

Open SimonSimCity opened this issue 3 years ago • 1 comments
trafficstars

When I run graphql queries using the package apollo-server-azure-functions, I found out that all graphql requests called over HTTP (by design) return a 200 response code.

This made me realize how my failing requests are not picked up by Azure Application Insights as errorous requests but as successful ones, even those having no data at all.

Because I chose not to show errors to the user which are internal to my setup, it's crucial to me to see them in analyics-boards like Application Insights.

SimonSimCity avatar Jun 09 '22 06:06 SimonSimCity

Do you specifically mean all GraphQL requests that successfully make it to the execution of the operation, or literally all GraphQL requests? (Issues like incorrect formatting, parse errors, etc should not result in 200s.)

You can use the plugin API to change the HTTP status based on particular execution errors, though it's a bit on the awkward side.

glasser avatar Jun 10 '22 05:06 glasser

Changing HTTP status via plugin is now less awkward in AS v4. It looks like this question is resolved, or at the very least stale.

trevor-scheer avatar Oct 20 '22 20:10 trevor-scheer