-
Notifications
You must be signed in to change notification settings - Fork 306
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
On Node 20: The requested module 'hot-shots' does not provide an export named 'StatsD' #3703
Comments
I tested the same with Node 18.18.1 and 19.9.0, but didn't get that error |
Managed to work around this issue like this: import statsd from "hot-shots";
const { StatsD } = statsd; |
FYI @khanayan123 |
Now the issue also occurs on Node 18.19.0. I tried your workaround, but it doesn't work for me as-is in TypeScript code: Referencing the type
It also affects all kinds of modules, like mobx, express, ... Testing with mobx 6.12.0: This library is meant to be imported via
For now we have to use an older Node version until this is fixed. |
I have run into this issue with It appears that the DD loader is not exposing some of the exports from the module: # With loader enabled
node --import ./register/datadog.mjs
Welcome to Node.js v20.10.0.
Type ".help" for more information.
> (await import("@nestjs/common")).All
undefined
>
# Without loader enabled
node
Welcome to Node.js v20.10.0.
Type ".help" for more information.
> (await import("@nestjs/common")).All
[Function (anonymous)]
>
import { register } from 'node:module'
import { pathToFileURL } from 'node:url'
register('dd-trace/loader-hook.mjs', pathToFileURL(import.meta.url)) |
This problem is solved for me by nodejs/import-in-the-middle#30. For now I am using |
We just try to upgrade our Node/ESM project to Node.js 20(.8.0). Without datadog, our services are running fine, but when adding the loader to the startup command via
node --loader dd-trace/loader-hook.mjs ...
, we get the following error (ignoring the warnings for now):The text was updated successfully, but these errors were encountered: