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

Catch fetch errors or allow overwrite fetch #131

Closed
bkniffler opened this issue Jan 9, 2024 · 3 comments
Closed

Catch fetch errors or allow overwrite fetch #131

bkniffler opened this issue Jan 9, 2024 · 3 comments

Comments

@bkniffler
Copy link

Getting this error during log ingestion:

FetchError: request to https://api.axiom.co/v1/datasets/..../ingest failed, reason: getaddrinfo ENOTFOUND api.axiom.co

This is causing unhandled promise rejection with the automatic flushing.

I'd suggest we get some option to capture this, e.g.

const axiom = new Axiom({
  token: '...',
  orgId: '...',
  fetch: async (a, b) => fetch(a, b).catch(() => ..)
  // or
  handleError: () => ....
});
@dasfmi
Copy link
Collaborator

dasfmi commented Feb 7, 2024

I am working on handling those exception now, finalizing the PR.

@dasfmi
Copy link
Collaborator

dasfmi commented Feb 9, 2024

we have a released a new version of axiom-js and axiom-pino that would solve the exceptions handling in axiom-js. on Monday we will continue investigating Pino package and add some tests to ensure that doesn't happen again. let us know if this works our for you, and if there is any thing we can improve on the new onError() method.

@dasfmi dasfmi closed this as completed Feb 28, 2024
@bkniffler
Copy link
Author

Hey, thanks @schehata, it did indeed solve my problem, I'm using onError to suppress errors, thanks!

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

2 participants