firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 915 forks source link

Pub/Sub emulator fails to start when cache path contains a whitespace #7313

Closed janek515 closed 2 weeks ago

janek515 commented 2 weeks ago

[REQUIRED] Environment info

firebase-tools: 13.11.2

Platform: Windows

[REQUIRED] Test case

When the cache path where the emulator binaries are stored contains a whitespace the pub sub emulator will fail to start. This will happen when your username on windows has a space in it.

[REQUIRED] Steps to reproduce

  1. Set the FIREBASE_EMULATORS_PATH environment variable to a path that contains a whitespace
  2. Try to run the pubsub emulator

[REQUIRED] Expected behavior

The emulator runs.

[REQUIRED] Actual behavior

It fails.

[2024-06-12T18:14:26.496Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2024-06-12T18:14:26.497Z] > authorizing via signed-in user (***)
i  emulators: Starting emulators: pubsub {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: pubsub"}}
[2024-06-12T18:14:26.506Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2024-06-12T18:14:26.507Z] [pubsub] Pub/Sub Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2024-06-12T18:14:26.507Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"pubsub":[{"address":"127.0.0.1","family":"IPv4","port":8085}]},"metadata":{"message":"assigned listening specs for emulators"}}
[2024-06-12T18:14:26.513Z] [hub] writing locator at C:\Users\JANOCH~1\AppData\Local\Temp\hub-bdo-app-1.json
[2024-06-12T18:14:26.528Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/**** [none]
[2024-06-12T18:14:26.853Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/**** 200
[2024-06-12T18:14:26.854Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/**** {"projectId":"****","projectNumber":"*****","displayName":"******","name":"projects/****","resources":{"hostingSite":"****","realtimeDatabaseInstance":"****-default-rtdb","storageBucket":"****.appspot.com","locationId":"europe-west"},"state":"ACTIVE","etag":"*******"}
[2024-06-12T18:14:26.856Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"pubsub"},"message":"Ignoring unsupported arg: projectId"}}
[2024-06-12T18:14:26.856Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"pubsub"},"message":"Ignoring unsupported arg: auto_download"}} 
[2024-06-12T18:14:26.857Z] Starting Pub/Sub Emulator with command {"binary":"C:\\Users\\Jan Ochwat\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\cloud-pubsub-emulator.bat","args":["--host=127.0.0.1","--port=8085"],"optionalArgs":["port","host"],"joinArgs":true,"shell":true} {"metadata":{"emulator":{"name":"pubsub"},"message":"Starting Pub/Sub Emulator with command {\"binary\":\"C:\\\\Users\\\\Jan Ochwat\\\\.cache\\\\firebase\\\\emulators\\\\pubsub-emulator-0.8.14\\\\pubsub-emulator\\\\bin\\\\cloud-pubsub-emulator.bat\",\"args\":[\"--host=127.0.0.1\",\"--port=8085\"],\"optionalArgs\":[\"port\",\"host\"],\"joinArgs\":true,\"shell\":true}"}}
i  pubsub: Pub/Sub Emulator logging to pubsub-debug.log {"metadata":{"emulator":{"name":"pubsub"},"message":"Pub/Sub Emulator logging to \u001b[1mpubsub-debug.log\u001b[22m"}}
[2024-06-12T18:14:26.867Z] 'C:\Users\Jan' is not recognized as an internal or external command,
operable program or batch file.
 {"metadata":{"emulator":{"name":"pubsub"},"message":"'C:\\Users\\Jan' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"}}
!  pubsub: Fatal error occurred:
   Pub/Sub Emulator has exited with code: 1,
   stopping all running emulators {"metadata":{"emulator":{"name":"pubsub"},"message":"Fatal error occurred: \n   Pub/Sub Emulator has exited with code: 1, \n   stopping all running emulators"}}
i  pubsub: Stopping Pub/Sub Emulator {"metadata":{"emulator":{"name":"pubsub"},"message":"Stopping Pub/Sub Emulator"}}
i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
aalej commented 2 weeks ago

Hey @janek515, thanks for reporting this and for submitting a fix! I’m able to reproduce this issue. I tried creating a new user on Windows with a space in the username, and when starting the emulators an error was raised. Let me raise this to our engineering team so they can take a look into the issue as well as the PR.

joehan commented 2 weeks ago

Thanks for fixing this! Merged your PR, it will go out in the next release.

simeon9696 commented 1 day ago

Hey was this release issued? I'm facing the same error