axiomhq / axiom-js

Official language bindings and library extensions for Axiom
https://axiom.co
MIT License
89 stars 14 forks source link

Fails silently on node 16 #103

Open nmpereira opened 10 months ago

nmpereira commented 10 months ago

Description

I was trying out the @axiomhq/js and the @axiomhq/winston packages and both seem to fail on node 16 but give out little to no information/errors.

The documented axiom-winston (https://github.com/axiomhq/axiom-js/tree/main/packages/winston) method were logging the winston logs locally, but not sending it to axiom. There were no errors/messages/indication of why it was failing.

Then I tried the js method (https://github.com/axiomhq/axiom-js/tree/main/packages/js) which failed with ReferenceError: fetch is not defined.

After upgrading to node 20, which does have built-in fetch support, It seemed to work well.

I also did get a Error: Not found that's pretty unhelpful.

[1] Error: Not Found
[1]     at FetchClient.doReq (/Users/.../...node_modules/@axiomhq/src/fetchClient.ts:42:29)
[1]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[1]     at async Batch.flush (/Users/.../.../node_modules/@axiomhq/src/batch.ts:61:17)

Expected

  1. Documentation about supported node version and/or how to import fetch correctly
  2. fix on axiom-winston to not fail silently
  3. Diagnose Error: Not found error to give more information.
  4. axiom-winston gives no error/information if there are missing/wrong tokens/dataset etc. Need some logs for this.

Info

Failing on node version: v16.20.0 Works fine on node version: v20.9.0

kannthu commented 9 months ago

This is due https://github.com/axiomhq/axiom-js/commit/ab6d344f706a24993985721c21612a8574c7973e - they removed "cross-fetch" and do not have any polyfills - so if you try using axiom in node it will fail...

@axiom-js Please add ANY fetch polyfill to the package.

albertovasquez commented 9 months ago

Any chance we get fetch working again? Is this still the libary to use for nodejs?

SollyzDev commented 8 months ago

This is due ab6d344 - they removed "cross-fetch" and do not have any polyfills - so if you try using axiom in node it will fail...

@axiom-js Please add ANY fetch polyfill to the package.

can you import the polyfill package right before axiom-js? I believe node 16 is deprecated.

nmpereira commented 8 months ago

The problem isn't the lack of support for fetch. It's the fact that it's failing without any indication as to why, making it extremely difficult to diagnose the issue.

There should be a warning or indication when logs are not being sent to axiom

flazouh commented 1 month ago

Hello???? Trying to use rhe package ans no logs are sent