Skip to content

Cloud Function deploy fails for Firestore-triggered function #6364

@dominoFire

Description

@dominoFire

[REQUIRED] Environment info

firebase-tools: 12.4.7

Platform: Windows

[REQUIRED] Test case

When I try to deploy a triggered Python, 2nd-gen cloud function, it fails with a database not found error.

[REQUIRED] Steps to reproduce

  1. Create a function in your main.py:
@firestore_fn.on_document_created(document='a/{aId}/b/{bId}')
def do_magic(event: Event[DocumentSnapshot]) -> None:
    """
    Do magic
    """


    return None
  1. Run firebase deploy on the function.

[REQUIRED] Expected behavior

Deploys succeeds.

[REQUIRED] Actual behavior

Deploy fails with the following message:

firebase-debug.log


=== Deploying to 'propio-app'...

i  deploying functions
i  functions: preparing codebase default for deployment
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
+  functions: required API cloudfunctions.googleapis.com is enabled
+  functions: required API cloudbuild.googleapis.com is enabled
+  artifactregistry: required API artifactregistry.googleapis.com is enabled
i  functions: Loading and analyzing source code for codebase default to determine what to deploy
 * Serving Flask app 'serving'
 * Debug mode: off

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8081
Press CTRL+C to quit

127.0.0.1 - - [15/Sep/2023 13:13:27] "GET /__/functions.yaml HTTP/1.1" 200 -

2023-09-15 13:13:27,719 - werkzeug - INFO - 127.0.0.1 - - [15/Sep/2023 13:13:27] "GET /__/functions.yaml HTTP/1.1" 200 -

127.0.0.1 - - [15/Sep/2023 13:13:27] "GET /__/quitquitquit HTTP/1.1" 200 -

2023-09-15 13:13:27,728 - werkzeug - INFO - 127.0.0.1 - - [15/Sep/2023 13:13:27] "GET /__/quitquitquit HTTP/1.1" 200 -

i  functions: preparing functions directory for uploading...
i  functions: packaged C:\src\propio3\webapp\backend\functions (40.74 KB) for uploading
There was an error retrieving the Firestore database. Currently, the database id is set to (default), make sure it exists.

Error: Failed to make request to http://127.0.0.1:8080/v1/projects/propio-app/databases/(default)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions