Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Functions emulator fails with space in project directory path #5854

Closed
benbrunyee opened this issue May 17, 2023 · 3 comments
Closed

Comments

@benbrunyee
Copy link

benbrunyee commented May 17, 2023

[REQUIRED] Environment info

firebase-tools: 12.0.1

Platform: Windows

[REQUIRED] Test case

  1. Create a directory with a space e.g., `C:\Users\name\Desktop\project directory\
  2. Run firebase init functions and run through the setup for Python functions.
  3. Fix any pip version errors you get and re-run firebase init functions to get dependencies installed
  4. Run firebase init emulators and setup the functions emulator
  5. Run firebase emulators:start and see error below:
bruny:vite-project$ firebase emulators:start
i  emulators: Starting emulators: functions
!  ui: Emulator UI unable to start on port 4000, starting on 4001 instead.
!  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "C:\Users\bruny\Desktop\project directory\vite-project\functions" for Cloud Functions...
!  functions: Failed to detect functions from source FirebaseError: User code failed to load. Cannot determine backend specification.
stderr:C:\Users\bruny\AppData\Local\Programs\Python\Python311\python.exe: can't open file 'C:\\Users\\bruny\\Desktop\\project': [Errno 2] No such file or directory

!!  functions: Failed to load function definition from source: FetchError: request to http:https://127.0.0.1:8081/__/quitquitquit failed, reason: connect ECONNREFUSED 127.0.0.1:8081

[REQUIRED] Steps to reproduce

(More environment info)
yarn --version = 1.22.19
vite --version = vite/4.3.3 win32-x64 node-v16.13.2

  1. Create a directory with a space e.g., `C:\Users\name\Desktop\project directory\
  2. Create a SveltKit vite project in the above directory with yarn create vite. Select SvelteKit and TypeScript as the options. The project name here does not matter
  3. Run firebase init functions and run through the setup for Python functions.
  4. Fix any pip version errors you get and re-run firebase init functions to get dependencies installed
  5. Run firebase init emulators and setup the functions emulator
  6. Run firebase emulators:start and see error below:
bruny:vite-project$ firebase emulators:start
i  emulators: Starting emulators: functions
!  ui: Emulator UI unable to start on port 4000, starting on 4001 instead.
!  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "C:\Users\bruny\Desktop\project directory\vite-project\functions" for Cloud Functions...
!  functions: Failed to detect functions from source FirebaseError: User code failed to load. Cannot determine backend specification.
stderr:C:\Users\bruny\AppData\Local\Programs\Python\Python311\python.exe: can't open file 'C:\\Users\\bruny\\Desktop\\project': [Errno 2] No such file or directory

!!  functions: Failed to load function definition from source: FetchError: request to http:https://127.0.0.1:8081/__/quitquitquit failed, reason: connect ECONNREFUSED 127.0.0.1:8081

[REQUIRED] Expected behavior

The functions emulator should be able to handle spaces in directory paths.
This should work in Git Bash, CMD, PowerShell

[REQUIRED] Actual behavior

The emulator fails to run unless I modify the path to remove the space.
This is the case when running using Git Bash, CMD and PowerShell

@google-oss-bot
Copy link
Contributor

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

@aalej
Copy link
Contributor

aalej commented May 17, 2023

Hi @benbrunyee, thanks for reporting this issue. I was able to replicate the behavior you mentioned using firebase-tools v12.0.1 on a macOS machine by following steps similar to the one provided in your test case:

  1. Create a directory with a space
  2. Run firebase init functions and run through the setup for Python functions.
  3. Run firebase init emulators and setup the functions emulator
  4. Run firebase emulators:start

That said, I’ll notify our team about this so that we can investigate this issue. I'll also be marking this issue as reproducible.

@taeold taeold self-assigned this May 17, 2023
taeold pushed a commit that referenced this issue May 17, 2023
<!--

Thank you for contributing to the Firebase community! Please fill out the form below.

Run the linter and test suite
==============================
Run `npm test` to make sure your changes compile properly and the tests all pass on your local machine. We've hooked up this repo with continuous integration to double check those things for you.

-->

### Description

<!-- Are you fixing a bug? Implementing a new feature? Make sure we have the context around your change. Link to other relevant issues or pull requests. -->

Proposed fix for #5854.

Related to  #5830. Issue seems to be similar as the error message shows the incomplete path when path has spaces.  e.g. if path is `/Users/<user>/Desktop/project directory/function`, error message will shows path `/Users/<user>/Desktop/project`.

### Scenarios Tested

<!-- Write a list of all the user journeys and edge cases you've tested. Instructions for manual testing can be found at https://github.com/firebase/firebase-tools/blob/master/.github/CONTRIBUTING.md#development-setup -->

1. Create a directory with a space 
2. Run `firebase init functions` and run through the setup for Python functions.
3. Run `firebase init emulators` and setup the functions emulator
4. Run `firebase emulators:start`


### Sample Commands

<!-- Proposing a change to commands or flags? Provide examples of how they will be used. -->

`firebase emulators:start`
@taeold
Copy link
Contributor

taeold commented May 19, 2023

The issue should be resolved in the next release. Thank you for reporting the issue!

@taeold taeold closed this as completed May 19, 2023
tonyjhuang pushed a commit that referenced this issue May 22, 2023
<!--

Thank you for contributing to the Firebase community! Please fill out the form below.

Run the linter and test suite
==============================
Run `npm test` to make sure your changes compile properly and the tests all pass on your local machine. We've hooked up this repo with continuous integration to double check those things for you.

-->

### Description

<!-- Are you fixing a bug? Implementing a new feature? Make sure we have the context around your change. Link to other relevant issues or pull requests. -->

Proposed fix for #5854.

Related to  #5830. Issue seems to be similar as the error message shows the incomplete path when path has spaces.  e.g. if path is `/Users/<user>/Desktop/project directory/function`, error message will shows path `/Users/<user>/Desktop/project`.

### Scenarios Tested

<!-- Write a list of all the user journeys and edge cases you've tested. Instructions for manual testing can be found at https://github.com/firebase/firebase-tools/blob/master/.github/CONTRIBUTING.md#development-setup -->

1. Create a directory with a space 
2. Run `firebase init functions` and run through the setup for Python functions.
3. Run `firebase init emulators` and setup the functions emulator
4. Run `firebase emulators:start`


### Sample Commands

<!-- Proposing a change to commands or flags? Provide examples of how they will be used. -->

`firebase emulators:start`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants