Skip to content

Conversation

@aalej
Copy link
Contributor

@aalej aalej commented Jun 9, 2025

Description

Fixes #4688

Currently, running firebase emulators:start --import does/not/exists --export-on-exit throws a warning message Error: ENOENT: no such file or directory, mkdir '/Users/alejandromarco/Desktop/firebase-tools/issues/4688/does/not/exists' then the export exits

$ firebase emulators:start --import does/not/exists --export-on-exit
⚠  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: auth, firestore, database, storage
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  database: Database Emulator logging to database-debug.log

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4000/               │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ 127.0.0.1:8080 │ http://127.0.0.1:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Database       │ 127.0.0.1:9000 │ http://127.0.0.1:4000/database  │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ 127.0.0.1:9199 │ http://127.0.0.1:4000/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub host: 127.0.0.1 port: 4400
  Other reserved ports: 4500, 9150

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
 
^C 
i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "does/not/exists" please wait for the export to finish...
i  Found running emulator hub for project fir-support-testproj at http://127.0.0.1:4400
i  Creating export directory /Users/alejandromarco/Desktop/firebase-tools/issues/4688/does/not/exists
⚠  Error: ENOENT: no such file or directory, mkdir '/Users/alejandromarco/Desktop/firebase-tools/issues/4688/does/not/exists'
⚠  Automatic export to "does/not/exists" failed, going to exit now...
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
i  database: Stopping Database Emulator
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  storage: Stopping Storage Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

Scenarios Tested

Verified that the directory gets created even if it does not exists

$ firebase emulators:start --import does/not/exists --export-on-exit
⚠  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: auth, firestore, database, storage
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  database: Database Emulator logging to database-debug.log

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4000/               │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ 127.0.0.1:8080 │ http://127.0.0.1:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Database       │ 127.0.0.1:9000 │ http://127.0.0.1:4000/database  │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ 127.0.0.1:9199 │ http://127.0.0.1:4000/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub host: 127.0.0.1 port: 4400
  Other reserved ports: 4500, 9150

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
 
^C 
i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "does/not/exists" please wait for the export to finish...
i  Found running emulator hub for project fir-support-testproj at http://127.0.0.1:4400
i  Creating export directory /Users/alejandromarco/Desktop/firebase-tools/issues/4688/does/not/exists
i  Exporting data to: /Users/alejandromarco/Desktop/firebase-tools/issues/4688/does/not/exists
i  emulators: Received export request. Exporting data to /Users/alejandromarco/Desktop/firebase-tools/issues/4688/does/not/exists.
✔  emulators: Export complete.
✔  Export complete
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
i  database: Stopping Database Emulator
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  storage: Stopping Storage Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

Sample Commands

@aalej aalej requested a review from joehan June 10, 2025 11:43
Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - it a little weird that importing from a nonexistant directory doesn't error, but that seems like a separate issue

@joehan joehan merged commit 8815f64 into master Jun 10, 2025
48 of 50 checks passed
@joehan joehan deleted the aalej-export-mkdirrecursive branch June 10, 2025 16:20
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export does not work when the Import folder does not exist

2 participants