Open ryprice opened 1 year ago
@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 we've just released a new version of the library --> https://github.com/sematext/logsene-js/releases/tag/1.1.77 Please, try it out and tell us if the issue has been removed. Thanks :)
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.