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

Module not found: Can't resolve 'encoding' #7369

Closed
AlexBrasileiro opened this issue Jun 16, 2023 · 3 comments
Closed

Module not found: Can't resolve 'encoding' #7369

AlexBrasileiro opened this issue Jun 16, 2023 · 3 comments

Comments

@AlexBrasileiro
Copy link

Operating System

macOS

Browser Version

Chrome

Firebase SDK Version

^9.22.2

Firebase SDK Product:

Functions

Describe your project's tooling

NextJS 13

Describe the problem

In development (local), in the NextJS logs, a warning appears (on the server side):

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

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/@firebase/functions/dist/esm-node/index.node.esm.js
./node_modules/firebase/functions/dist/index.mjs
./src/utils/firebase.js
./src/components/Mailing.js
./src/components/Footer.js

Steps and code to reproduce issue

The warning appears whenever you import Firebase from any file.

firebase.js

import { initializeApp, getApps } from 'firebase/app';
import { getFunctions, connectFunctionsEmulator } from 'firebase/functions';

const config = {
  apiKey: "xxxxx",
  authDomain: "xxxxx",
  ...
};

const app = !getApps().length ? initializeApp(config) : getApps()[0];

let functions = getFunctions(app);

if (process.env.NODE_ENV === 'development') connectFunctionsEmulator(functions, 'localhost', '5001');

export {
  functions
};
@AlexBrasileiro AlexBrasileiro added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Jun 16, 2023
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: functions v9 and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Jun 16, 2023
@hsubox76
Copy link
Contributor

This is a duplicate of #7280. I modified the title of that one so it's easier to find.

@AlexBrasileiro
Copy link
Author

@hsubox76 thanks!

@firebase firebase locked and limited conversation to collaborators Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants