Skip to content
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

Can't resolve 'encoding' #612

Closed
thorwebdev opened this issue Oct 26, 2022 · 32 comments · Fixed by #850
Closed

Can't resolve 'encoding' #612

thorwebdev opened this issue Oct 26, 2022 · 32 comments · Fixed by #850
Assignees

Comments

@thorwebdev
Copy link
Member

thorwebdev commented Oct 26, 2022

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: supabase/auth-helpers#340

It's related to an old version of node-fetch being used in cross-fetch: node-fetch/node-fetch#412 lquixada/cross-fetch#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
Copy link

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
Copy link

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

@kamtorocks
Copy link

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

pnpm add -D encoding

With this you can run.

@cdedreuille
Copy link

Any update on this one @thorwebdev ?

@soedirgo
Copy link
Member

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

@robbiecren07
Copy link

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
Copy link

@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
Copy link

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

@datashard
Copy link

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
Copy link

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

@mthmcalixto
Copy link

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
Copy link

gondar00 commented Jul 5, 2023

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
Copy link

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
Copy link

JP-Soup commented Jul 12, 2023

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
Copy link

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
Copy link

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

@cdedreuille
Copy link

@thorwebdev @soedirgo Any update on this one?

@aokigit
Copy link

aokigit commented Aug 15, 2023

Still happening on Next 13.4.15

@khRasikh
Copy link

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

@hkbertoson
Copy link

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

@soedirgo
Copy link
Member

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

razor-x added a commit to seamapi/seam-components-sample-apps that referenced this issue Aug 18, 2023
@andrijantasevski
Copy link

andrijantasevski commented Aug 20, 2023

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
Copy link

i switched to pnpm, this solved it

soedirgo added a commit to supabase/auth-js that referenced this issue Aug 23, 2023
@robbiecren07
Copy link

robbiecren07 commented Aug 26, 2023

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
Copy link
Member

soedirgo commented Sep 11, 2023

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
Copy link

This seems to have fixed the issue in my case!

@AarooneyFarr
Copy link

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

@activenode
Copy link

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
Copy link

isener commented Sep 20, 2023

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
Copy link

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

npm add -D encoding

With this you can run.
and prob solved.

@MildTomato
Copy link

MildTomato commented Aug 26, 2024

@soedirgo

node 20

Screenshot 2024-08-26 at 16 45 18

@kevcodez
Copy link

@MildTomato realtime-js imports ws, which in turn relies on a bunch of Nodejs internal libs. There's another ongoing PR to remove the ws library - supabase/realtime-js#426

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 a pull request may close this issue.