You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
firebase deploy crashes due to next.js image optimization check, version 12.4.5 #6163
Proprietary source code using "next/image" (image optimization with Node.js), hosted on firebase using Firebase Hosting and Firebase Functions. The code is built using GitHub Actions and deployed using FirebaseExtended/action-hosting-deploy@v0, which uses the latest firebase-tools version. The GitHub Actions job config is below.
[REQUIRED] Steps to reproduce
Run the FirebaseExtended/action-hosting-deploy@v0 GitHub action, which pulls the latest firebase-tools version, in this case 12.4.5
action-hosting-deploy runs firebase deploy
firebase deploy crashes in isUsingNextImageInAppDirectory
[REQUIRED] Expected behavior
firebase deploy should run successfully and identify Next.js image optimization occurences.
Note: even with the previous version (12.4.4), firebase-tools does not identify the usage of the image optimization in my private repository and I have to create an empty server action for the image optimization to work, otherwise it does not identify the image optimization usage and does not generate a firebase function. If I create an empty server action, then a function is generated and image optimization works as a result of the function being generated for a different purpose
[REQUIRED] Actual behavior
firebase deploy crashes with the stack trace shown below
[2023-07-20T18:06:01.090Z] Error: ENOENT: no such file or directory, open '/home/runner/work/github-repo/github-repo/.next/server/client-reference-manifest.js'
Error: An unexpected error has occurred.
The process '/opt/hostedtoolcache/node/16.20.1/x64/bin/npx' failed with exit code 2
Error: The process '/opt/hostedtoolcache/node/16.20.1/x64/bin/npx' failed with exit code 2
***
conclusion: 'failure',
output: ***
title: 'Deploy preview failed',
summary: "Error: The process '/opt/hostedtoolcache/node/16.20.1/x64/bin/npx' failed with exit code 2"
***
***
This issue matches #6135 so we can probably fix it by downgrading our tools..
Downgrading next to 13.4.9 fixed deploys for us. Thanks @vladimir-voinea !
This issues is marked as close. but I am getting this error
[debug] [2023-07-21T06:24:05.855Z] TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)')
at __asyncValues (/usr/local/lib/node_modules/firebase-tools/lib/frameworks/next/utils.js:4:14)
at isUsingNextImageInAppDirectory (/usr/local/lib/node_modules/firebase-tools/lib/frameworks/next/utils.js:114:39)
at isUsingImageOptimization (/usr/local/lib/node_modules/firebase-tools/lib/frameworks/next/utils.js:99:19)
at async build (/usr/local/lib/node_modules/firebase-tools/lib/frameworks/next/index.js:71:9)
at async prepareFrameworks (/usr/local/lib/node_modules/firebase-tools/lib/frameworks/index.js:216:33)
at async deploy (/usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:55:13)
[error]
[error] Error: An unexpected error has occurred.
Hey @AF-Metasky, #6166 fixed this but it will only be available in the next release. In the meantime, please use Next.js 13.4.9 and firebase-tools 12.4.4
Activity
AF-Metasky commentedon Jul 20, 2023
Facing the exact same issue

Nushio commentedon Jul 20, 2023
We're having the same issue when deploying via the github action but our workaround is deploying through our laptops :-)
vladimir-voinea commentedon Jul 20, 2023
There is another workaround, you can indicate the version of firebase-tools you want to use in the GitHub Actions yaml file:
Nushio commentedon Jul 20, 2023
Specifying version 12.4.4 did not fix it for us.
This issue matches #6135 so we can probably fix it by downgrading our tools..
Downgrading next to 13.4.9 fixed deploys for us. Thanks @vladimir-voinea !
AF-Metasky commentedon Jul 21, 2023
This issues is marked as close. but I am getting this error
leoortizz commentedon Jul 21, 2023
Hey @AF-Metasky, #6166 fixed this but it will only be available in the next release. In the meantime, please use Next.js
13.4.9and firebase-tools12.4.4jpenna commentedon Aug 5, 2023
I updated
firebase-toolsfrom12.4.5to12.4.7and keptnext: 13.4.12and it worked