Skip to content

'The requested module '@grpc/grpc-js' is expected to be of type CommonJS' Getting issue while deploying next js application by gcp CICD pipeline. #5983

@krishna-fenixwork

Description

@krishna-fenixwork

Hey, I'm building the next js application. Recently, while deploying my project through the GCP CICD pipeline, I'm getting this error -

`
info - Checking validity of types...
warn - No ESLint configuration detected. Run next lint to begin setup
info - Creating an optimized production build...
info - Compiled successfully
info - Collecting page data...

Build error occurred
file:///workspace/node_modules/@firebase/firestore/dist/index.node.mjs:7
import { credentials, loadPackageDefinition, Metadata } from '@grpc/grpc-js';
^^^^^^^^
SyntaxError: The requested module '@grpc/grpc-js' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from '@grpc/grpc-js';
const { credentials, loadPackageDefinition, Metadata } = pkg;
at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:137:5)
at async Loader.import (internal/modules/esm/loader.js:165:24) {
type: 'SyntaxError'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
`

I couldn't understand what causing the issue. I tried downgrading the version of firebase and firebase-functions too, but It didn't seem to work. Can anyone help me with that?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions