I have a firebase project which is already beyond the point to restart everything and I already worked with the firebase functions framework as a proof of concept at the beginning with the standard functions from Google (add message) and creating collections in firestorm from the main.py file works fine.
As soon as I now try to implement a function such as
@https_fn.on_request()
def addmessage(req: https_fn.Request) -> https_fn.Response:
"""Take the text parameter passed to this HTTP endpoint and insert it into
a new document in the messages collection."""
# Grab the text parameter.
original = req.args.get("text")
if original is None:
return https_fn.Response("No text parameter provided", status=400)
firestore_client: google.cloud.firestore.Client = firestore.client()
# Push the new message into Cloud Firestore using the Firebase Admin SDK.
_, doc_ref = firestore_client.collection("messages").add({"original": original})
# Send back a message that we've successfully written the message
return https_fn.Response(f"Message with ID {doc_ref.id} added.")
bash firebase deploy
or firebase deploy --only functions
gets stuck with the following error:
Could not create or update Cloud Run service addmessage, Container Healthcheck failed. Revision ‘addmessage-00001-ruv’ is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
I already deleted the docker containers in the artifact registry and it does not change anything.
The functions seemingly asynchronously appear in the functions console after unsuccessful deployment with a warning triangle and unknown trigger and when redeployed, they can not be changed but only be deleted.
Aside from this behaviour, my project works fine.