Skip to content

feat: allow providing custom fetch implementation #168

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

Merged
merged 1 commit into from
Nov 8, 2021
Merged

feat: allow providing custom fetch implementation #168

merged 1 commit into from
Nov 8, 2021

Conversation

jacobwgillespie
Copy link
Contributor

@jacobwgillespie jacobwgillespie commented Nov 6, 2021

What kind of change does this PR introduce?

This PR adds the ability to provide a custom fetch implementation as an option - this is most useful for environments where cross-fetch is not supported, for instance Cloudflare Workers or Vercel Edge Functions.

This is related to supabase/supabase-js#154, and I believe a similar option would need to be added to the other libraries using cross-fetch before being finally added to supabase-js.

What is the current behavior?

At the moment, cross-fetch is always used in all environments.

What is the new behavior?

There is a new option fetch that can be provided to override cross-fetch with an alternative library (or the native fetch):

import { GoTrueClient } from '@supabase/gotrue-js'

const GOTRUE_URL = 'http://localhost:9999'

const auth = new GoTrueClient({ url: GOTRUE_URL, fetch: fetch })

Additional context

Wrapped library PRs:

supabase-js PR:

@kiwicopple kiwicopple merged commit 0cb0b12 into supabase:master Nov 8, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2021

🎉 This PR is included in version 1.20.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

leynier added a commit to leynier/gotrue-py that referenced this pull request Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants