-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Using nodejs build-in fetch doesn't seem to work with the undici plugin #7958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ah and I am not seeing the url from the console.log in the |
So dug around this a bit more. I was able to subscribe to the events emitted by fetch (which is built into my node version) like this:
But it still doesn't seem to work in the sentry undici plugin. Turns out I can make it work if I do this in the node_modules/@sentry/node/cjs/integrations/undici/index.js file
So for some reasons, the dynamic import fails for me, just requiring it works fine 🤷 |
Hi, are you using ESM mode (or |
No, it's using commonjs. I verified by also editing the file in the esm folder (in node_modules), that had no impact |
Aight. This one is kinda weird. Can you check if this is still not working with Node 20? Maybe Node 19 is buggy (wouldn't be the first time it happened)? |
Dammit, you are right ... node@20 fixes the issue. This is wild! Thanks for your help |
Glad to hear! I will close this then. @AbhiPrasad said he will update our docs in case anybody else runs into this. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.49.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
I have some custom written code that uses Node v19 fetch (so without undici). Code looks like this
const response = await fetch(endpoint, { method: 'POST', body: JSON.stringify({ query: print(document), variables }), headers: { 'Content-Type': 'application/json', ...headers }, });
I am also using the algoliasearch package which uses node's http.
Expected Result
I would expect that sentries creates a span for my
fetch
operation.Actual Result
First call is the one using algolia, second one fetch
The text was updated successfully, but these errors were encountered: