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

FEA Support Axios 'fetch' adapter in order to support more serverless platforms #740

Open
drush opened this issue Feb 7, 2025 · 2 comments

Comments

@drush
Copy link

drush commented Feb 7, 2025

SDK you're using (please complete the following information):

  • Version 10.0.0

Is your feature request related to a problem? Please describe.
Serverless platforms (specifically Cloudflare Workers/Pages) may not support some of all of the 'http' functions. In the CF case, they do not fully support the HTTPS handling. (They do support the fetch variation).

Describe the solution you'd like
Enable xero-node to set the axios adapter to the 'fetch' adapter (which is now built-in) at configuration time. It may be necessary to add an addiitonal optional parameter to XeroClient to set this value. Alternatively, the whole project may prefer to use fetch by default in v11.

Describe alternatives you've considered

  1. There does not appear to be a way to override the axios adapter without explicit code changes
  2. Axios detects 'http' because CF mocks it, but CF does not fully implement it. This means, the http adapter is chosen as the default, but later functions fail.

Additional context
Quick code validation:

  1. run the xero-node tests: npm test (all pass)
  2. Add this to line 6 of the XeroClient.ts file: axios.defaults.adapter = 'fetch';
  3. Run tests again - 3 failures

Image

Copy link

github-actions bot commented Feb 7, 2025

PETOSS-700

Copy link

github-actions bot commented Feb 7, 2025

Thanks for raising an issue, a ticket has been created to track your request

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

1 participant