-
Notifications
You must be signed in to change notification settings - Fork 28
Missing "authtype" and "authid" for "on_document_written_with_auth_context" trigger functions in emulators #210
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
Comments
Hello @andreas-thomik. Is this only reproducible with emulators? |
Honestly not tested since #207 makes the |
@exaby73 I can confirm that this happens for both emulators and live functions. Here's a minimal example to reproduce: import logging
import firebase_functions.firestore_fn
from firebase_functions.firestore_fn import (
AuthEvent,
Change,
DocumentSnapshot,
_firestore_endpoint_handler,
on_document_created_with_auth_context,
on_document_written_with_auth_context,
)
logger = logging.getLogger()
def _inspect_endpoint_handler(*args, **kwargs):
logger.warning("Args: %s", args)
logger.warning("Kwargs: %s", kwargs)
return _firestore_endpoint_handler(*args, **kwargs)
firebase_functions.firestore_fn._firestore_endpoint_handler = (
_inspect_endpoint_handler
)
@on_document_written_with_auth_context(document="tests/{docId}")
def test_doc_written(event: AuthEvent[Change[DocumentSnapshot | None]]):
return event
@on_document_created_with_auth_context(document="tests/{docId}")
def test_doc_created(event: AuthEvent[DocumentSnapshot]):
return event The actual parameters sent to Logs for {
"attributes": {
"specversion": "1.0",
"id": "...",
"source": "//firestore.googleapis.com/projects/MY-PROJECT/databases/(default)",
"type": "google.cloud.firestore.document.v1.written",
"datacontenttype": "application/protobuf",
"dataschema": "https://github.com/googleapis/google-cloudevents/blob/main/proto/google/events/cloud/firestore/v1/data.proto",
"subject": "documents/tests/LmbRywPwqsWgVJmG4JNe",
"time": "2024-07-01T19:24:45.860351Z",
"namespace": "(default)",
"document": "tests/LmbRywPwqsWgVJmG4JNe",
"location": "europe-west6",
"database": "(default)",
"project": "MY-PROJECT"
},
"data": "..."
} Compare this with the logs for {
"attributes": {
"specversion": "1.0",
"id": "...",
"source": "//firestore.googleapis.com/projects/MY-PROJECT/databases/(default)",
"type": "google.cloud.firestore.document.v1.created.withAuthContext",
"datacontenttype": "application/protobuf",
"dataschema": "https://github.com/googleapis/google-cloudevents/blob/main/proto/google/events/cloud/firestore/v1/data.proto",
"subject": "documents/tests/LmbRywPwqsWgVJmG4JNe",
"time": "2024-07-01T19:24:45.860351Z",
"location": "europe-west6",
"namespace": "(default)",
"document": "tests/LmbRywPwqsWgVJmG4JNe",
"authtype": "unknown",
"project": "MY-PROJECT",
"database": "(default)",
"authid": "MY-EMAIL"
},
"data": "..."
} |
This seems to be an upstream issue. I've raised this forward. I'll get back to you soon on an update on this issue |
For context, seems to be a similar issue on the Node SDK as well (firebase/firebase-functions#1582) |
Should be fixed by #214 and a release should go out soon |
Pretty much what the title says. The
authid
andauthtype
fields are present for all the otheron_document_<...>_with_auth_context
functions but are missing foron_document_written_with_auth_context
This might be an issue with the emulators themselves, if so please let me know and I'll post it to the relevant issue tracker.
The text was updated successfully, but these errors were encountered: