supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
2.79k stars 216 forks source link

Can't resolve 'encoding' #612

Closed thorwebdev closed 7 months ago

thorwebdev commented 1 year ago

Module not found: Can't resolve 'encoding' in '/Users/thorwebdev/Documents/code/supabase/quickstarts/supabase-next-13/node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib'

This warning is printed when using supabase-js in nextjs 13 project: https://github.com/supabase/auth-helpers/issues/340

It's related to an old version of node-fetch being used in cross-fetch: https://github.com/node-fetch/node-fetch/issues/412 https://github.com/lquixada/cross-fetch/issues/146

It should be safe to ignore as it's an optional dependency in node-fetch, but might be worthwhile to see if we can get rid of the warning.

cdedreuille commented 1 year ago

I'm seeing the same issue.

Module not found: Can't resolve 'encoding' in '/Users/cdedreuille/Sites/kapture/node_modules/node-fetch/lib'

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/supabase-js/dist/main/lib/fetch.js
./node_modules/@supabase/supabase-js/dist/main/SupabaseClient.js
./node_modules/@supabase/supabase-js/dist/main/index.js
./lib/supabase.ts
./app/app/page.tsx

./node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in '/Users/cdedreuille/Sites/kapture/node_modules/node-fetch/lib'

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/supabase-js/dist/main/lib/fetch.js
./node_modules/@supabase/supabase-js/dist/main/SupabaseClient.js
./node_modules/@supabase/supabase-js/dist/main/index.js
./lib/supabase.ts
./app/app/components/image.tsx
./app/app/components/grid.tsx

Everything is working as expected but it would be great to make it go away.

SharadKumar commented 1 year ago

Yes, am getting the same with the latest Nextjs 13.1.6. Everything works though.

kamto7 commented 1 year ago

I am using node 18+ version, It does not need cross-fetch.

pnpm add -D encoding

With this you can run.

cdedreuille commented 1 year ago

Any update on this one @thorwebdev ?

soedirgo commented 1 year ago

@cdedreuille no update so far, but I'll take a look this week.

robbiecren07 commented 1 year ago

As @kamto7 suggested, using npm: npm i -D encoding Removes the error. I'm going to test a deployment on Vercel later this week to see if i'm able to deploy successfully.

datashard commented 10 months ago

@robbiecren07 Did you get around to trying it?

I just freshly installed it locally and have it running locally, but I still seem to be getting this Error

robbiecren07 commented 10 months ago

Yup I forgot to reply, I was able to deploy with no issues after running the above command in terminal.

datashard commented 10 months ago

Might be good if someone opens a PR to add this Library as a Dependency.

Unless someone else wants to do this, I'm probably gonna open one soon-ish

akashislam1 commented 9 months ago

whwn i use npm i -D encoding everything is working .

mthmcalixto commented 9 months ago

whwn i use npm i -D encoding everything is working .

It's amazing how at the same time the error is old but is so current

gondar00 commented 9 months ago

Facing the same issue with next 13.4.3

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/storage-js/dist/main/lib/helpers.js
./node_modules/@supabase/storage-js/dist/main/packages/StorageFileApi.js
./node_modules/@supabase/storage-js/dist/main/StorageClient.js
./node_modules/@supabase/storage-js/dist/main/index.js
./lib/supabase-storage.js
./app/api/upload/route.ts
MildTomato commented 9 months ago

same issue on next next@13.4.9 with turbo turbo@1.10.7

npm i -D encoding seems like a good workaround for now 🚀

JP-Soup commented 9 months ago

Same issue, but for use with Firebase. On next@13.4.9 and node v18.16.1. npm i -D encoding has removed the error.

cristovalmartinez commented 9 months ago

I am having the same error message with Nextjs semver 13.4.1. However, no issues deploying, and everything works as intended in production.

What gives?

luxonauta commented 8 months ago

Ran into this as well, looking forward to the fix. Thank folks!

cdedreuille commented 8 months ago

@thorwebdev @soedirgo Any update on this one?

aokigit commented 8 months ago

Still happening on Next 13.4.15

khRasikh commented 8 months ago

For me, I am using the same version (Next.js 13.4.15) and npm i -D encoding is working.

hkbertoson commented 8 months ago

Using Next.JS 13.4.16 and can confirm that pnpm add -D encoding resolved this error.

soedirgo commented 8 months ago

Hey all, we're still looking into a solution that doesn't require npm i -D encoding.

andrijantasevski commented 8 months ago

Hey, I still have this error on Next 13.4.19. I can confirm that adding encoding with pnpm add -D encoding works, but it is not an ideal solution.

sjohns21 commented 8 months ago

i switched to pnpm, this solved it

robbiecren07 commented 7 months ago

Looks like this will be resolved soon? @soedirgo I have an active project im working on with:

"@supabase/auth-helpers-nextjs": "^0.7.4",
 "@supabase/supabase-js": "^2.32.0",
"next": "13.4.19",
"react": "18.2.0",

So I can test, once released.

soedirgo commented 7 months ago

Hey all, can you check if the errors are still there after upgrading supabase-js to v2.33.2?

p.s. Please also try to uninstall encoding if you had to install that as a workaround. Thanks!

TomasHubelbauer commented 7 months ago

This seems to have fixed the issue in my case!

AarooneyFarr commented 7 months ago

Fixed it for me as well! (with encoding not installed)

activenode commented 7 months ago

Hey all, can you check if the errors are still there after upgrading supabase-js to v2.33.2?

p.s. Please also try to uninstall encoding if you had to install that as a workaround. Thanks!

Confirmed

isener commented 7 months ago

Hey all, can you check if the errors are still there after upgrading supabase-js to v2.33.2?

p.s. Please also try to uninstall encoding if you had to install that as a workaround. Thanks!

This sorted out the issue! Appreciated!

Shashi-Srivastav commented 4 months ago

I am using node 18+ version, It does not need cross-fetch.

npm add -D encoding

With this you can run. and prob solved.