firebase / firebase/firebase-tools

Failed deploy when creating api functions from nextjs

Open
#9,319 0 comments 0 reactions 0 assignees View on GitHub
integration: web frameworks type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

● (SSG) prerendered as static HTML (uses getStaticProps)
ƒ (Dynamic) server-rendered on demand

Building a Cloud Function to run this application. This is needed due to:
• Image Optimization
• non-static route /api/addParticipant
• non-static route /api/assistant
• non-static route /api/apply
• non-static route /api/assistantMistral
• and 126 other reasons, use --debug to see more

Failed to find esbuild with npx which: Error: Command failed: npx which esbuild
esbuild not found, installing...
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: react-mathjax@1.0.1
npm error Found: react@18.2.0
npm error node_modules/react
npm error peer react@">=16.8.6" from @dytesdk/react-ui-kit@1.61.4
npm error node_modules/@dytesdk/react-ui-kit
npm error @dytesdk/react-ui-kit@"^1.61.4" from the root project
npm error peer react@">=16.8.6" from @dytesdk/react-web-core@1.35.15
npm error node_modules/@dytesdk/react-web-core
npm error @dytesdk/react-web-core@"^1.35.15" from the root project
npm error 81 more (@embedapi/react, @emotion/react, @emotion/styled, ...)
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.3.0" from react-mathjax@1.0.1
npm error node_modules/react-mathjax
npm error react-mathjax@"^1.0.1" from the root project
npm error
npm error Conflicting peer dependency: react@16.14.0
npm error node_modules/react
npm error peer react@"^16.3.0" from react-mathjax@1.0.1
npm error node_modules/react-mathjax
npm error react-mathjax@"^1.0.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/ucefkh/.npm/_logs/2025-10-15T10_15_38_154Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/ucefkh/.npm/_logs/2025-10-15T10_15_38_154Z-debug-0.log
Unable to bundle next.config.js for use in Cloud Functions, proceeding with deploy but problems may be encountered.
Failed to install esbuild: Error: Command failed: npm install esbuild@^0.19.2 --no-save
⚠ This integration expects Node version 16, 18, or 20. You're running version 22, problems may be encountered.
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: react-mathjax@1.0.1
npm error Found: react@18.2.0
npm error node_modules/react
npm error react@"^18.2.0" from the root project
npm error peer react@">=16.8.6" from @dytesdk/react-ui-kit@1.61.4
npm error node_modules/@dytesdk/react-ui-kit
npm error @dytesdk/react-ui-kit@"^1.61.4" from the root project
npm error 81 more (@dytesdk/react-web-core, @embedapi/react, ...)
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.3.0" from react-mathjax@1.0.1
npm error node_modules/react-mathjax
npm error react-mathjax@"^1.0.1" from the root project
npm error
npm error Conflicting peer dependency: react@16.14.0
npm error node_modules/react
npm error peer react@"^16.3.0" from react-mathjax@1.0.1
npm error node_modules/react-mathjax
npm error react-mathjax@"^1.0.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/ucefkh/.npm/_logs/2025-10-15T10_15_42_214Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/ucefkh/.npm/_logs/2025-10-15T10_15_42_214Z-debug-0.log

Error: An unexpected error has occurred.

also one thing i dont use npm i use yarn to build and run it

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Firebase deploy for the Next.js app with Node 22 and the reported Yarn setup, then inspect the deployment path that bundles next.config.js and installs esbuild. Use the ERESOLVE output and the listed /api routes to narrow the failure; done means the app deploys without the esbuild or dependency-resolution errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, node.js
Domain
cli, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.