Skip to content
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

http-client doesn't receive any data since Node is updated #2707

Closed
ZivojnovicZarko opened this issue Jan 19, 2023 · 9 comments
Closed

http-client doesn't receive any data since Node is updated #2707

ZivojnovicZarko opened this issue Jan 19, 2023 · 9 comments
Labels
bug Something isn't working integration-fetch

Comments

@ZivojnovicZarko
Copy link

ZivojnovicZarko commented Jan 19, 2023

Expected behaviour
dd-trace should send data to datadog http-client service

Actual behaviour
http-client service is missing data

Environment

  • Node.js version: 18.12.1
  • Tracer version: 3.11.0
  • Relevant library versions: Next.js 12.3.1

After updating Node to v.18 on our Next.js project datadog stopped receiving http-client data. On other Node.js project not using Next everything work fine, so our assumption is that something is wrong with combination Next.js / Node 18.
When downgrade Node to version 16.17.0 http-client service is back.

Any idea what should be the issue?

@ZivojnovicZarko ZivojnovicZarko added the bug Something isn't working label Jan 19, 2023
@tlhunter
Copy link
Member

tlhunter commented Feb 10, 2023

Can you provide a minimal reproduction? Something that I can easily run locally that exhibits this issue? Once we have that we should be able to diagnose.

@rochdev
Copy link
Member

rochdev commented Mar 24, 2023

@ZivojnovicZarko Is this still an issue for you? And if it is, can you provide a reproduction snippet or steps to reproduce?

@mb21
Copy link

mb21 commented Apr 4, 2023

I'm working with @ZivojnovicZarko and yes, unfortunately it's still an issue for us. Sorry that we haven't gotten around to setting up a reproducible example yet, but the theory is that setting up a new Next.js project and running it on Node.js (with the specified versions), and then making a fetch request (using the built-in fetch of node.js 18.12) from next's getInitialProps (or getServerSideProps) will fail to generate an http-client trace.

@Qard
Copy link
Contributor

Qard commented Apr 6, 2023

The fetch API is not yet supported. It's not built on http.Client so you won't get http-client spans from it.

@mb21
Copy link

mb21 commented Apr 11, 2023

@Qard oh, interesting. Weird thing is that using plain fetch api with a express service on the same node version works for us. That's why we thought it must have to do with next.js...

@Qard
Copy link
Contributor

Qard commented Apr 12, 2023

Do you mean global fetch function or node-fetch? Also, Next.js has it's own custom patched version of fetch, if I recall correctly, so we'd need specific support for that, as far I can tell.

@mb21
Copy link

mb21 commented Apr 13, 2023

I'm saying that global fetch in node 18.12.1 works for us (not using node-fetch, which also used to work before we removed it).

Next.js has it's own custom patched version of fetch, if I recall correctly, so we'd need specific support for that, as far I can tell.

I see, that's what we were suspecting and what this issue is about then. Weird thing is that the patched version of fetch worked as well on node 16.17.0. (Note: we're using next 12, not next 13 which has the new app directory, RSC and even more patched fetch.)

@mb21
Copy link

mb21 commented Apr 13, 2023

Although interesting, console.log(fetch.toString()) in an empty node prompt and in a next.js getInitialProps function both print the same thing:

async function fetch(input, init = undefined) {
    emitExperimentalWarning('The Fetch API');
    return lazyUndici().fetch(input, init);
  }

so not sure our theory is actually correct...

@tlhunter
Copy link
Member

It looks like this issue became a feature request for undici/fetch support. I'll close it as a duplicate of #1615 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integration-fetch
Projects
None yet
Development

No branches or pull requests

5 participants