trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

[TRI-861] Next.js warning - Module not found: Can't resolve encoding

Open ericallam opened this issue 2 years ago • 3 comments

Using the @trigger.dev/sdk in a Next.js project produces the following warning:

- warn ./node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in '/Users/eric/code/triggerdotdev/trigger.dev-examples/latest-packages/node_modules/node-fetch/lib'

It turns out this is a pretty widely experienced warning that doesn't actually effect anything in Next.js. See this supabase-js issue:

https://github.com/supabase/supabase-js/issues/612

encoding is an optional dependency of node-fetch and so there is no issue with it missing.

If you would like to get rid of this warning, just run:

npm add encoding -D

To add the encoding dependency to your dev deps. Of course this won't stop this warning from appearing from production builds, so you can also do:

npm add encoding

TRI-861

ericallam avatar Aug 02 '23 13:08 ericallam

Any update on this? Others seems to have fixed this issue such as supabase.

TotomInc avatar Oct 10 '23 13:10 TotomInc

@TotomInc This is going to be fixed once this merged PR is published: https://github.com/triggerdotdev/trigger.dev/pull/581

It removes the usage of node-fetch which is what was causing this error. Will hopefully be released in the next day or so 👍

ericallam avatar Oct 10 '23 14:10 ericallam

@ericallam nice! Will this change introduce support for non-node platforms such as Vercel Edge functions, Deno, etc?

rosswaycaster avatar Oct 10 '23 20:10 rosswaycaster