Skip to content

Commit

Permalink
fix: replace cross-fetch with @supabase/node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed Sep 11, 2023
1 parent 766238e commit 8cf2b96
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 56 deletions.
80 changes: 32 additions & 48 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals"
},
"dependencies": {
"@supabase/functions-js": "^2.1.0",
"@supabase/gotrue-js": "^2.46.1",
"@supabase/postgrest-js": "^1.8.0",
"@supabase/functions-js": "^2.1.5",
"@supabase/gotrue-js": "^2.51.0",
"@supabase/node-fetch": "^2.6.14",
"@supabase/postgrest-js": "^1.8.4",
"@supabase/realtime-js": "^2.7.4",
"@supabase/storage-js": "^2.5.1",
"cross-fetch": "^3.1.5"
"@supabase/storage-js": "^2.5.4"
},
"devDependencies": {
"@types/jest": "^29.2.5",
Expand Down
7 changes: 4 additions & 3 deletions src/lib/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import crossFetch, { Headers as CrossFetchHeaders } from 'cross-fetch'
// @ts-ignore
import nodeFetch, { Headers as NodeFetchHeaders } from '@supabase/node-fetch'

type Fetch = typeof fetch

Expand All @@ -7,7 +8,7 @@ export const resolveFetch = (customFetch?: Fetch): Fetch => {
if (customFetch) {
_fetch = customFetch
} else if (typeof fetch === 'undefined') {
_fetch = crossFetch as unknown as Fetch
_fetch = nodeFetch as unknown as Fetch
} else {
_fetch = fetch
}
Expand All @@ -16,7 +17,7 @@ export const resolveFetch = (customFetch?: Fetch): Fetch => {

export const resolveHeadersConstructor = () => {
if (typeof Headers === 'undefined') {
return CrossFetchHeaders
return NodeFetchHeaders
}

return Headers
Expand Down

0 comments on commit 8cf2b96

Please sign in to comment.