Skip to content

feat: allow providing custom fetch implementation #297

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 #297

merged 1 commit into from
Nov 8, 2021

Conversation

jacobwgillespie
Copy link
Contributor

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 #154 and depends on the following PRs in the wrapped client libraries:

All three of those PRs would need to be merged before this PR builds correctly / functions.

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 { createClient } from '@supabase/supabase-js'

// Provide a custom `fetch` implementation as an option
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { fetch: fetch })

Additional context

Dependent PRs:

@kiwicopple
Copy link
Member

🔥 🔥 🔥 🔥 🔥

This is a very impressive series of PR's @jacobwgillespie - let me run some tests then merge if everything looks good

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

Successfully merging this pull request may close these issues.

2 participants