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

Fetch API vs Axios #39

Open
TheDunco opened this issue Sep 26, 2023 · 5 comments
Open

Fetch API vs Axios #39

TheDunco opened this issue Sep 26, 2023 · 5 comments

Comments

@TheDunco
Copy link

Would it be possible for future versions of the API to use the standard fetch API instead of Axios? From what I've seen Axios is making the API more difficult to work with, as we don't get standard things like response.ok to check successes with.

Another issue is that the errors that come back from the API are nested deep within the {caught error/response}.response.data.errors object and it took me forever to realize that I was actually getting error data back. I'd at least like to see a generic KlaviyoApiError Type exported from the package so we know the shape of the error data that's coming back.

@pete183
Copy link

pete183 commented Oct 5, 2023

Another reason to support fetch is Axios isn't supported on some runtimes such as Vercel serverless

- adapter xhr is not supported by the environment
- adapter http is not available in the build
    at new Promise (<anonymous>)```

@pauldraper
Copy link

Well this is klaviyo-api-node :P

@charkour
Copy link

Vercel serverless functions execute a Node process: https://vercel.com/docs/functions/runtimes/node-js

@pauldraper
Copy link

Yeah, maybe @pete183 is referring to Vercel Edge?

@Ian-Montgomery-Klaviyo
Copy link
Collaborator

The team is looking into switching to fetch.

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

5 participants