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

Cloudflare workers issues with cross-fetch (xmlhttprequest is not defined) #227

Closed
bkniffler opened this issue Nov 23, 2021 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@bkniffler
Copy link

This library uses cross-fetch, which makes running in Cloudflare workers impossible.

Reference:
https://community.cloudflare.com/t/xmlhttprequest-is-not-defined/133866/4

Solution:
Not using cross-fetch and let users polyfill via node-fetch/cross-fetch/isomorphic-fetch themselves. Obviously this will be super duper breaking. Not sure if there is any other way though.

@bkniffler bkniffler added the enhancement New feature or request label Nov 23, 2021
@bkniffler bkniffler changed the title Cloudflare workers issues with cross-fetch Cloudflare workers issues with cross-fetch (xmlhttprequest is not defined) Nov 23, 2021
@bnjmnt4n
Copy link
Contributor

bnjmnt4n commented Nov 23, 2021

See supabase/supabase-js#297 and #222. Passing a custom fetch looks like it should be fully supported without bugs in supabase-js 1.28.1.

@bkniffler
Copy link
Author

Oh wow, great, thanks @bnjmnt4n. Just found lquixada/cross-fetch#69 by coincidence and the username @kiwicopple seemed familiar :)

I'll try the suggested solution and close this issue.

@soedirgo
Copy link
Member

This should be resolved now afaik. Custom fetch is not needed - the lib now uses the global fetch if available, and otherwise falls back to cross-fetch (previously it always uses cross-fetch, which caused issues).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants