Skip to content

chore(lib/fetch): dynamic import @supabase/node-fetch #1306

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

Closed

Conversation

liyachun01
Copy link

@liyachun01 liyachun01 commented Nov 9, 2024

Dynamic import('@supabase/node-fetch') in lib/fetch to avoid possible Cannot read property 'bind' of undefined error.

Closes #1303

@liyachun01 liyachun01 changed the title chore(lib/fetch): dynamic import @supabase/node-fetch (#1303) chore(lib/fetch): dynamic import @supabase/node-fetch Nov 9, 2024
@liyachun01 liyachun01 force-pushed the chore/dynamic-node-fetch-import branch from 4bf9624 to 3fb82a1 Compare November 9, 2024 14:01
@liyachun01
Copy link
Author

Similar updates are made to @supabase/postgrest-js, see supabase/postgrest-js#576

@liyachun01
Copy link
Author

Hi @soedirgo, please kindly look at this PR, thanks~

@jsprds
Copy link

jsprds commented Dec 10, 2024

In my opinion this is a very good improvement, thanks for the work @liyachun01! This will probably also solve problems when using supabase-js in an Angular project with SSR enabled.

I hope that this PR can be reviewed and merged in the near future. 🤞

@mandarini mandarini self-assigned this Jul 24, 2025
@mandarini mandarini added javascript Pull requests that update javascript code enhancement New feature or request labels Jul 24, 2025
@mandarini
Copy link
Contributor

Hi @liyachun01 ! Thank you so much for your contribution and for taking the time to address issue #1303!

I will not be merging this PR now, as the async approach introduces a performance regression for all browser requests (every request now requires an unnecessary await even when Headers is immediately available).

That being said, once we officially drop support for Node 18 (October 31st) as we recently announced, and remove the @supabase/node-fetch dependency on November 1st, this issue will be resolved entirely without any performance impact.

I know this may not be the immediate solution you were hoping for, but I want to avoid introducing performance costs that affect all users when we have a clean, permanent fix coming in just a few months. I do hope you understand, and thank you very very much for your patience. I am also going to refer you to this PR, where I replied almost the same thing. I do hope my rationale makes sense for you.

If you think there's another solution that would keep everyone happy until November, please let me know! :D

Again, thank you very much for your patience and for contributing to Supabase!

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

Successfully merging this pull request may close these issues.

Request to dynamic import @supabase/node-fetch
3 participants