-
Notifications
You must be signed in to change notification settings - Fork 8
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
Module require incompatibility of node-fetch starting in 1.1.76 #54
Comments
@ryprice Thanks for the report, we'll have a look. Are you shipping your logs to Sematext or somewhere else? |
I'm shipping to sematext. Just a small sideproject I'm working on. |
hi @ryprice |
Hey, thanks for the quick turnaround, but unfortunately this didn't fix the problem. Now it just says nodeFetch is not a function. If I have time I'll try to figure out what needs to be done or at least make a distilled repro for you. The issue in my case isn't a conflict with window (In fact my env is node so window.fetch shouldn't be defined. logsene-js works fine in my frontend apps.) |
During a recently update from 1.1.75 -> 1.1.76, my service started erroring at runtime with this message:
This build uses typescript and webpack. I poked around the transpiled output, console logged
fetch
, and found that the imported value offetch
fromnode-fetch
was actually a module, not afetch
function. It looked something like:{FetchErrors, Headers, Request, Response, default}
. So it seems somewhere there's a mismatch about the style of module (commonjs, esm, etc).If it's of interest the transpiled line looked like this:
I'm not the most well versed in the different types of module bundling so I'm not sure what the fix here is, or if it's an issue in my build or in
logsene-js
configs. I should also note I have another librarygaxios
that also depends onnode-fetch
and it does not have any issues. The difference seems to be thatgaxios
has compiled lib files bundled with it.Thanks for your help.
The text was updated successfully, but these errors were encountered: