sensitive-blue
sensitive-blue5mo ago

Missing Sentry trace headers

I'm using "@refinedev/simple-rest" and have set up Sentry. All of my requests are missing sentry's tracing headers. The same sentry config is working well on non-refine projects. Has anyone else had issues like this? https://sentry.zendesk.com/hc/en-us/articles/20860046489243-Why-am-I-seeing-requests-with-sentry-baggage-and-sentry-trace-headers
Sentry Help Center
Why am I seeing requests with sentry baggage and sentry-trace headers?
Issue Sentry SDKs attach sentry-trace and baggage headers to outgoing requests from the application where the Sentry SDK is utilized.  We do this to connect events from one Sentry project to anothe...
5 Replies
kapa.ai
kapa.ai5mo ago
Hi @boris. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you might want to look into customizing the data provider for @refinedev/simple-rest to include Sentry's tracing headers in your requests. You can customize the data provider by following these steps: 1. Run the swizzle command in the project directory:
npm run refine swizzle

npm run refine swizzle

2. Select @refinedev/simple-rest from the list of available data providers. 3. Edit the /rest-data-provider/index.ts file to customize the data provider. You can add the necessary Sentry headers in this file. 4. Pass the customized data provider to the dataProvider prop of the Refine component:
import { Refine } from "@refinedev/core";
import { dataProvider } from "./rest-data-provider";

const App = () => {
return (
<Refine
dataProvider={dataProvider}
/* ... */
/>
);
};

import { Refine } from "@refinedev/core";
import { dataProvider } from "./rest-data-provider";

const App = () => {
return (
<Refine
dataProvider={dataProvider}
/* ... */
/>
);
};

For more detailed information, you can refer to the Customizing the data provider (https://refine.dev/docs/data/packages/simple-rest/#customizing-the-data-provider-) section in the documentation. If you need further assistance, you might want to check the Sentry documentation (https://sentry.zendesk.com/hc/en-us/articles/20860046489243-Why-am-I-seeing-requests-with-sentry-baggage-and-sentry-trace-headers) or reach out to the refine community for more specific guidance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@499582506736287744> kapa.ai is still learning and improving, please let us know how it did by reacting below
sensitive-blue
sensitive-blue5mo ago
Hey @boris it shouldn't be any different for Refine, it depends on your base framework. Vite, NextJS etc.. Did you initialize Sentry as early as possible? for Vite, it should be src/index.tsx, not App.tsx.
sensitive-blue
sensitive-blueOP5mo ago
Thanks for the quick reply @Batu ! I am using Vite - sentry is init quite early, alongside React's createRoot.
sensitive-blue
sensitive-blue5mo ago
It might be about Axios and react-query then. @aliemir found an issue and suggestion here: https://github.com/getsentry/sentry-javascript/issues/3169#issuecomment-1251179809 You can pass your own axios instance to simple-rest data provider.

Did you find this page helpful?