-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Enhancement description
This SDK is currently unusable in Cloudflare Workers because it uses axios, which strangely doesn't support using fetch
instead of the super-old XHR api (and it doesn't seem they plan to address it anytime soon axios/axios#1219). Moving from axios to something like isomorphic-fetch would solve the issue.
Bonus: doing this would make Deno work for free, I think, because Deno also supports fetch
. (#19)
Alternative, easier solution: expose an options object for the TodoistApi
constructor, with an adapter
option that lets me pass a custom axios adapter to use.
The problem it solves
I can't use this Todoist SDK in Cloudflare workers currently. I get this error:
TypeError: adapter is not a function
This is caused by these lines in axios
- it only supports node and environments with XHR. Cloudflare Workers is neither of those, unfortunately.
Alternatives
I haven't found a good workaround for this. One solution I've thought of is forking axios
, gutting it and replacing the internals with fetch
, and then using the resolutions/overrides field to make this package use my axios-but-actually-fetch
package instead of the real axios
. But that would be a lot of work 😅