firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Emulator export fails for Dataconnect

Open OutdatedGuy opened this issue 6 months ago • 2 comments
trafficstars

[REQUIRED] Environment info

firebase-tools: v14.4.0

Platform: macOS

[REQUIRED] Test case

NA

[REQUIRED] Steps to reproduce

  1. Create new firebase project with dataconnect enabled

  2. Run following command:

    firebase emulators:start --export-on-exit=./emulator-data
    
  3. Give exit command with Ctrl + C

  4. See error while exporting emulator data

[REQUIRED] Expected behavior

All the dataconnect emulator data to be stored inside the emulator-data/dataconnect_export/postgres.tar.gz

[REQUIRED] Actual behavior

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 "./emulator-data" please wait for the export to finish...
i  Found running emulator hub for project development-smileit at http://127.0.0.1:4400
i  Exporting data to: /usr/fproject/functions/emulator-data
i  emulators: Received export request. Exporting data to /usr/fproject/functions/emulator-data.
⚠  emulators: Export failed: ENOENT: no such file or directory, open '/usr/fproject/firebase-export-1747382123869exTRTX/dataconnect_export/postgres.tar.gz'
⚠  FirebaseError: Export request failed, see emulator logs for more information.
⚠  Automatic export to "./emulator-data" failed, going to exit now...
i  emulators: Shutting down emulators.

OutdatedGuy avatar May 16 '25 07:05 OutdatedGuy

Hey @OutdatedGuy - could you share the debug logs from this run?

joehan avatar May 16 '25 17:05 joehan

dataconnect-debug.log

I0517 03:25:04.353248   29885 load.go:37] Reloading schema and connectors...
I0517 03:25:04.435751   29885 control.go:73] [/emulator/fdc 7d75] UpdateResources(): done
Schema: sources: schema/schema.gql [1008B] 
Connector "default": sources: connector/mutations.gql [890B] connector/queries.gql [908B] 
I0517 03:25:04.468504   29885 collector.go:107] schema extensions wrote into "/usr/fproject/dataconnect/.dataconnect/schema"
Generated sources: main/input.gql [15836B] prelude.gql [71531B] main/relation.gql [6179B] main/query.gql [4629B] main/mutation.gql [6678B] main/implicit.gql [282B] 
I0517 03:25:04.468670   29885 load.go:115] Finished reloading
I0517 03:25:04.472259   29885 dev.go:95] Listening on address (HTTP + gRPC): [::]:9399
I0517 03:25:07.221120   29885 control.go:73] [/emulator/fdc 0648] UpdateResources(): done
Schema: sources: schema/schema.gql [1008B] 
Connector "default": sources: connector/mutations.gql [890B] connector/queries.gql [908B] 


@joehan looks like this issue only occurs when the emulator is started using script from package.json or when run from inside the functions directory.

  1. Create a firebase project with functions and dataconnect enabled with firebase init

  2. Add following script inside functions/package.json:

    "emulator:export": "firebase emulators:start --export-on-exit=./emulator-data --project=demo-export-issue"
    
  3. Run the script with npm run emulator:export

  4. Give exit command with Ctrl + C

  5. See exporting error

It looks like the cli is searching for postgres.tar.gz from the root of project even if the command was ran from a sub-directory (i.e. functions)

OutdatedGuy avatar May 16 '25 22:05 OutdatedGuy

Hi @joehan, still facing the same issue in firebase-tools: 14.18.0, any idea what's going on or any workaround?

OutdatedGuy avatar Oct 06 '25 08:10 OutdatedGuy