Skip to content

Commit

Permalink
fix: use @supabase/node-fetch (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed Aug 23, 2023
1 parent 617dcfd commit bdfd212
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 48 deletions.
64 changes: 20 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -36,7 +36,7 @@
"docs:json": "typedoc --json docs/v2/spec.json --excludeExternals --excludePrivate --excludeProtected src/index.ts"
},
"dependencies": {
"cross-fetch": "^3.1.5"
"@supabase/node-fetch": "^2.6.13"
},
"devDependencies": {
"@types/faker": "^5.1.6",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers.ts
Expand Up @@ -93,7 +93,7 @@ export const resolveFetch = (customFetch?: Fetch): Fetch => {
if (customFetch) {
_fetch = customFetch
} else if (typeof fetch === 'undefined') {
_fetch = async (...args) => await (await import('cross-fetch')).fetch(...args)
_fetch = (...args) => import('@supabase/node-fetch' as any).then(({ default: fetch }) => fetch(...args))
} else {
_fetch = fetch
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/locks.ts
@@ -1,4 +1,4 @@
import { supportsLocalStorage } from "./helpers"
import { supportsLocalStorage } from './helpers'

/**
* @experimental
Expand Down
3 changes: 2 additions & 1 deletion test/fetch.test.ts
@@ -1,5 +1,6 @@
import { MockServer } from 'jest-mock-server'
import fetch from 'cross-fetch'
// @ts-ignore
import fetch from '@supabase/node-fetch'
import { AuthUnknownError, AuthApiError, AuthRetryableFetchError } from '../src/lib/errors'
import { _request } from '../src/lib/fetch'

Expand Down

0 comments on commit bdfd212

Please sign in to comment.