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

Fails silently on node 16 #103

Open
nmpereira opened this issue Nov 2, 2023 · 6 comments
Open

Fails silently on node 16 #103

nmpereira opened this issue Nov 2, 2023 · 6 comments

Comments

@nmpereira
Copy link

nmpereira commented Nov 2, 2023

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
Copy link

kannthu commented Nov 21, 2023

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.

@albertovasquez
Copy link

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

@dasfmi
Copy link
Collaborator

dasfmi commented Jan 5, 2024

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
Copy link
Author

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
Copy link

flazouh commented Jul 29, 2024

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

@awwit
Copy link

awwit commented Oct 23, 2024

Don't forget to expose fetch polyfill inside worker if logger uses workers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants