iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🤯

Fixing the issue of Firebase Emulators suddenly crashing in CI environments

に公開

Firebase Emulators Running in CI Suddenly Crashed

An error like this:
Also, Jest tests were timing out.
(Due to the failure of the emulator access part)

⚠  emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
i  emulators: Starting emulators: firestore
i  emulators: Shutting down emulators.

Error: No project active, but project aliases are available.

Cause

The fundamental cause seems to be a breaking change in firebase-tools.
The direct cause was that firebase-tools was being installed without specifying a version in the CI yml file.

This is a problem that wouldn't have occurred if I had specified a version from the beginning or kept updating properly. Code written without much thought ends up consuming your resources after a delay... I'll take this as a lesson.

Solution

Previously installed without specifying a version:

yarn add firebase-tools

Install with a specified version:

yarn add 'firebase-tools@{desired version}'

ex

ci.yml
name: CI with Firebase
on:
  pull_request:
    types: [opened, synchronize]
    paths:
      - "hoge/path"
jobs:
  test:
   # Omitted
   
    steps:
    - name: install firebase-tools
      run: yarn add 'firebase-tools@^9.16.1'

Discussion