firebase / firebase/firebase-tools

Next.js cloud function builds failing on first firebase deploy

Open
#6,446 40 comments 14 reactions 2 assignees Assigned to @Berlioz View on GitHub
api: functions integration: web frameworks Needs: Attention reproducible type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 12.7.0

**Platform:** macOS

**Next:** 13.4.19

### [REQUIRED] Test case

Added firebase to an existing, simple next app with a couple of `api` endpoints and the cloud function build fails.

### [REQUIRED] Steps to reproduce

Add firebase with `firebase hosting init` to a next.js application with server side endpoints. run `firebase deploy`

### [REQUIRED] Expected behavior

The functions build finishes

### [REQUIRED] Actual behavior

```
Building a Cloud Function to run this application. This is needed due to:
• Image Optimization
• non-static component /api/hubspot/route
• non-static component /api/getstarted/route
• non-static component /api/superblocks/route

npm ERR! code 2
npm ERR! path /Users/christopherbull/dev/1z_web/one-zero/.firebase/website-399615/functions/node_modules/sharp
npm ERR! command failed
npm ERR! command /Users/christopherbull/.cache/firebase/runtime/shell -c -- (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! /bin/sh: --: invalid option
npm ERR! Usage: /bin/sh [GNU long option] [option] ...
npm ERR! /bin/sh [GNU long option] [option] script-file ...
npm ERR! GNU long options:
npm ERR! --debug
npm ERR! --debugger
npm ERR! --dump-po-strings
npm ERR! --dump-strings
npm ERR! --help
npm ERR! --init-file
npm ERR! --login
npm ERR! --noediting
npm ERR! --noprofile
npm ERR! --norc
npm ERR! --posix
npm ERR! --protected
npm ERR! --rcfile
npm ERR! --restricted
npm ERR! --verbose
npm ERR! --version
npm ERR! --wordexp
npm ERR! Shell options:
npm ERR! -irsD or -c command or -O shopt_option (invocation only)
npm ERR! -abefhkmnptuvxBCHP or -o option

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/christopherbull/.npm/_logs/2023-10-13T11_12_35_546Z-debug-0.log
[2023-10-13T11:12:45.468Z] Error: Command failed: npm i --omit dev --no-audit
at checkExecSyncError (node:child_process:828:11)
at Object.execSync (node:child_process:899:15)
at execSync (pkg/prelude/bootstrap.js:2111:30)
at prepareFrameworks (/Users/christopherbull/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/frameworks/index.js:367:42)
at async deploy (/Users/christopherbull/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/index.js:55:13)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.