Skip to content

Not getting baggage and sentry-trace headers for fetch requests in React #8461

Closed Answered by AbhiPrasad
jamescrosswell asked this question in Q&A
Discussion options

You must be logged in to vote

hey @jamescrosswell

we rely on looking up a span/transaction on an internal storage we call the scope to determine if it's "active" or not. This is what we use to automatically attach spans generated from integrations as well as grab the active span to attach tracing headers.

So what you need to do here is to

const transaction = Sentry.startTransaction({ name: "saying hello" });
Sentry.configureScope(scope => {
  scope.setSpan(transaction);
});

// ... do fetch request logic here

Soon though we'll be officially releasing a helper to make this easy, in the meantime it's still exported so you can use it.

function App() {
  const sayHello  = async () => {
   const response = await Sentry.trace(

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
6 replies
@jamescrosswell
Comment options

@AbhiPrasad
Comment options

@AbhiPrasad
Comment options

@abentpole
Comment options

@AbhiPrasad
Comment options

Answer selected by jamescrosswell
Comment options

You must be logged in to vote
3 replies
@AbhiPrasad
Comment options

@joshacheson
Comment options

@AbhiPrasad
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants