sentry-javascript: sentry-trace header is not being attached to Apollo GraphQL requests
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser(by way of@sentry/react) -
@sentry/node -
raven-js -
raven-node(raven for node) - other:
Version:
5.22.1
Description
It’s my understanding according to this documentation that HTTP requests should have a sentry-trace header attached. If I make a fetch() request from my application frontend to my graphql endpoint, the header is attached. However, graphql requests from the Apollo library do not have this header attached.
I have previously manually added a different header for tracing purposes using the explanation provided here, but I’m trying to leverage the Sentry performance monitoring features so I would think the sentry-trace header is required.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (6 by maintainers)
@dhruska could it be that Apollo is being imported/loaded before Sentry in your project? If that’s the case, Apollo might be grabbing a reference to the original
fetchbefore the Sentry SDK patches it.@dhruska this is the part you are interested in - https://github.com/getsentry/sentry-javascript/blob/4ee0cd2a2cbbc42d1e86fb61666dde80e2a9ed2b/packages/node/src/handlers.ts#L27-L75 it should be rather straightforward to port it to hapi 😃
In addition to borrowing code from the Express integration, we document manual instrumentation at: https://docs.sentry.io/product/performance/getting-started/?platform=node
Closing for now as we’ve reached a happy ending for the header problem 😃