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

Nextjs issue with fetch (can't resolve encoding) #359

Closed
1 task done
ShravanSunder opened this issue Oct 8, 2023 · 1 comment
Closed
1 task done

Nextjs issue with fetch (can't resolve encoding) #359

ShravanSunder opened this issue Oct 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ShravanSunder
Copy link

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

usage of this module in a monorepo libary with Nextjs causes an error


Module not found: Can't resolve 'encoding' in '/Users/shravansunder/Documents/dev/project-dev/2023-askluna/node_modules/.pnpm/node-fetch@2.7.0/node_modules/node-fetch/lib'

Import trace for requested module:
../../node_modules/.pnpm/node-fetch@2.7.0/node_modules/node-fetch/lib/index.js
../../node_modules/.pnpm/openai@4.11.1/node_modules/openai/_shims/node-runtime.mjs
../../node_modules/.pnpm/openai@4.11.1/node_modules/openai/_shims/auto/runtime-node.mjs
../../node_modules/.pnpm/openai@4.11.1/node_modules/openai/_shims/index.mjs
../../node_modules/.pnpm/openai@4.11.1/node_modules/openai/core.mjs
../../node_modules/.pnpm/openai@4.11.1/node_modules/openai/index.mjs
../../packages/askluna-core/src/api/getOpenAIClient.ts

Its most likely the same issue supabase had: supabase/supabase-js#612
The recently resolved it.

To Reproduce

  1. create a monorepo library that uses the open api client
  2. create a nextjs app
  3. import the client or try to use it

you'll get this error during webpack compile.

Code snippets

No response

OS

macos

Node version

20

Library version

v4

@ShravanSunder ShravanSunder added the bug Something isn't working label Oct 8, 2023
@rattrayalex
Copy link
Collaborator

Is that an error, or just a warning? I believe you can safely ignore it (or silence it with npm i -D encoding, as noted in that thread).

Supabase silenced this warning by depending on their own fork of node-fetch which isn't something we'd like to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants