apollo-server
apollo-server copied to clipboard
Azure Functions: Report failed requests in Application Insights
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.
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.
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.