Skip to content

firebase deploy crashes due to next.js image optimization check, version 12.4.5 #6163

Closed

Description

@vladimir-voinea

[REQUIRED] Environment info

firebase-tools: 12.4.5

The issue seems to have been introduced with commit 7d2a90e

Platform: ubuntu-lastest (FirebaseExtended/action-hosting-deploy@v0)

[REQUIRED] Test case

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.

Screenshot 2023-07-20 005700

[REQUIRED] Steps to reproduce

  1. Run the FirebaseExtended/action-hosting-deploy@v0 GitHub action, which pulls the latest firebase-tools version, in this case 12.4.5
  2. action-hosting-deploy runs firebase deploy
  3. 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

Screenshot 2023-07-20 005207

Activity

  1. AF-Metasky commented on Jul 20, 2023

    @AF-Metasky

    Facing the exact same issue
    image

  2. Nushio commented on Jul 20, 2023

    @Nushio

    We're having the same issue when deploying via the github action but our workaround is deploying through our laptops :-)

  3. vladimir-voinea commented on Jul 20, 2023

    @vladimir-voinea
    Author

    We're having the same issue when deploying via the github action but our workaround is deploying through our laptops :-)

    There is another workaround, you can indicate the version of firebase-tools you want to use in the GitHub Actions yaml file:

          - uses: FirebaseExtended/action-hosting-deploy@v0
            env:
              FIREBASE_CLI_EXPERIMENTS: webframeworks
            with:
              repoToken: "${{ secrets.GITHUB_TOKEN }}"
              firebaseServiceAccount: .....
              firebaseToolsVersion: 12.4.4
              channelId: .....
              projectId: ......
    
  4. Nushio commented on Jul 20, 2023

    @Nushio

    Specifying version 12.4.4 did not fix it for us.

      [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 !

  5. self-assigned this
    on Jul 20, 2023
  6. AF-Metasky commented on Jul 21, 2023

    @AF-Metasky

    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.
    
  7. leoortizz commented on Jul 21, 2023

    @leoortizz
    Member

    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

  8. jpenna commented on Aug 5, 2023

    @jpenna

    I updated firebase-tools from 12.4.5 to 12.4.7 and kept next: 13.4.12 and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions