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

Library is not compatible with CloudFlare Workers / Vercel Edge functions #31

Open
emmems opened this issue Jun 3, 2023 · 3 comments
Open

Comments

@emmems
Copy link

emmems commented Jun 3, 2023

  • It uses axios which is not supported by neither of those two solutions :/
@lewandom
Copy link

More detailed error from a Next.js app, API route:

 [AxiosError: There is no suitable adapter to dispatch the request since :
- adapter xhr is not supported by the environment
- adapter http is not available in the build] {
  message: 'There is no suitable adapter to dispatch the request since :\n- adapter xhr is not supported by the environment\n- adapter http is not available in the build',
  name: 'AxiosError',
  code: 'ERR_NOT_SUPPORT'
}

Next.js edge runtime does not support full Node.js API. In particular, it doesn't support http module. It does support Fetch API though: https://nextjs.org/docs/app/api-reference/edge.

With Fetch API becoming stable in Node.js 21, it'd be nice to declare axios as an optional dependency and use Fetch API as the default request caller.

@multiplehats
Copy link

Just ran into this issue too, better to use the native fetch API instead of Axios :?

@isitgeorge
Copy link

Just ran into this - a potentially quicker fix could be to use this adapter that I have used with other libraries that rely on Axios, however would require some work to either pass the adapter in or expose the Axios object.

https://www.npmjs.com/package/@haverstack/axios-fetch-adapter

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

4 participants