Skip to content

webframeworks - Deploy with Github Actions throwing: TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)') #6171

@al4nnw

Description

@al4nnw

Overview

I am using firebase-tools in a Github workflow to automatically build and deploy a Next.js application to Firebase hosting on a PR event. The workflow is set up to fetch environment variables from Github Secrets. The project also requires access to a private repository within my organization, so I have set up SSH keys.

Locally, I'm able to deploy the application using firebase deploy, but when running the workflow on Github Actions, it fails with an error.

Workflow

build_and_preview
name: Deploy to Firebase Hosting on PR
"on": pull_request
env:
  NEXT_PUBLIC_API_KEY: "${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY_PROD }}"
  NEXT_PUBLIC_AUTH_DOMAIN: "${{ secrets.NEXT_PUBLIC_AUTH_DOMAIN_PROD }}"
  NEXT_PUBLIC_PROJECT_ID: "${{ secrets.NEXT_PUBLIC_PROJECT_ID_PROD }}"
  NEXT_PUBLIC_STORAGE_BUCKET: "${{ secrets.NEXT_PUBLIC_STORAGE_BUCKET_PROD }}"
  NEXT_PUBLIC_MESSAGING_SENDER_ID: "${{ secrets.NEXT_PUBLIC_MESSAGING_SENDER_ID_PROD }}"
  NEXT_PUBLIC_APP_ID: "${{ secrets.NEXT_PUBLIC_APP_ID_PROD }}"
  FIREBASE_CLI_EXPERIMENTS: webframeworks
jobs:
  build_and_preview:
    if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup SSH Keys
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.DEPLOY_KEY }}

      - name: Install and build
        run: npm ci && npm run build

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_APP_GDM_974E9 }}"
          projectId: -------
Few notes
  • I'm using all of firebase keys as Github Secrets;
  • It failed once asking to enable 'webframeworks' env and I did so;
  • It uses ssh to fetch a private repository inside my organization;

Environment info

Running on Github Actions.

firebase-tools:
[email protected] -> This is logged by the firebase job

Platform:
Linux.

Steps to reproduce

  • Set up a Next.js application with Firebase.
  • Configure a Github workflow as shown above.
  • Make a pull request to trigger the workflow.

Expected behavior

The workflow should successfully deploy the Next.js application to Firebase Hosting.

Actual behavior

The workflow fails with the following error:

[2023-07-23T21:53:46.575Z] TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)')
      at __asyncValues (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/frameworks/next/utils.js:4:14)
      at isUsingNextImageInAppDirectory (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/frameworks/next/utils.js:114:39)
      at isUsingImageOptimization (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/frameworks/next/utils.js:99:19)
      at async build (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/frameworks/next/index.js:71:9)
      at async prepareFrameworks (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/frameworks/index.js:216:33)
      at async deploy (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/deploy/index.js:55:13)
      at async Command.hostingChannelDeployAction [as actionFn] (/home/runner/.npm/_npx/ba4f1959e38407b5/node_modules/firebase-tools/lib/commands/hosting-channel-deploy.js:90:25)
  
  Error: An unexpected error has occurred.
  
  The process '/usr/local/bin/npx' failed with exit code 2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions