Skip to content

Commit c389915

Browse files
committed
fix: Revert "Merge pull request #175 from supabase/fix/supabase-node-fetch"
This reverts commit dc1d067, reversing changes made to b2e3486.
1 parent dc1d067 commit c389915

File tree

4 files changed

+89
-68
lines changed

4 files changed

+89
-68
lines changed

package-lock.json

Lines changed: 84 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"docs:json": "typedoc --json docs/v2/spec.json --entryPoints src/index.ts --entryPoints src/packages/* --excludePrivate --excludeExternals --excludeProtected"
3737
},
3838
"dependencies": {
39-
"@supabase/node-fetch": "^2.6.13"
39+
"cross-fetch": "^3.1.5"
4040
},
4141
"devDependencies": {
4242
"@types/jest": "^26.0.13",

src/lib/helpers.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ export const resolveFetch = (customFetch?: Fetch): Fetch => {
55
if (customFetch) {
66
_fetch = customFetch
77
} else if (typeof fetch === 'undefined') {
8-
_fetch = (...args) =>
9-
import('@supabase/node-fetch' as any).then(({ default: fetch }) => fetch(...args))
8+
_fetch = async (...args) => await (await import('cross-fetch')).fetch(...args)
109
} else {
1110
_fetch = fetch
1211
}
1312
return (...args) => _fetch(...args)
1413
}
1514

16-
export const resolveResponse = async (): Promise<typeof Response> => {
15+
export const resolveResponse = async () => {
1716
if (typeof Response === 'undefined') {
18-
// @ts-ignore
19-
return (await import('@supabase/node-fetch' as any)).Response
17+
return (await import('cross-fetch')).Response
2018
}
2119

2220
return Response

test/storageFileApi.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import * as fs from 'fs'
44
import * as path from 'path'
55
import FormData from 'form-data'
66
import assert from 'assert'
7-
// @ts-ignore
8-
import fetch from '@supabase/node-fetch'
7+
import fetch from 'cross-fetch'
98

109
// TODO: need to setup storage-api server for this test
1110
const URL = 'http://localhost:8000/storage/v1'

0 commit comments

Comments
 (0)