Repository navigation
Closed
Labels
Description
Related issues
No related issues found.
The capability was added through the firebase/firebase-functions#1519
[REQUIRED] Version info
node: v20.11.0
firebase-functions: v4.9.0
firebase-tools: v13.7.2
firebase-admin: v12.0.0
[REQUIRED] Test case
- Create a new event trigger function for
onDocumentCreatedWithAuthContext - Build the code if using typescript
- Run the emulators
- Watch it fail to run the emulators
The error returned from firebase-tools is:
[warn] ! Unexpected rules runtime error: Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.length()" because "line" is null
at com.google.firebase.rules.tools.local.server.Server.processRequestsFromInputStream(Server.java:75)
at com.google.firebase.rules.tools.local.server.Server.start(Server.java:57)
at com.google.firebase.rules.tools.local.FirebaseRulesTooling.main(FirebaseRulesTooling.java:81)
{"metadata":{"emulator":{"name":"storage"},"message":"Unexpected rules runtime error: Exception in thread \"main\" java.lang.NullPointerException: Cannot invoke \"String.length()\" because \"line\" is null\r\n\tat com.google.firebase.rules.tools.local.server.Server.processRequestsFromInputStream(Server.java:75)\r\n\tat com.google.firebase.rules.tools.local.server.Server.start(Server.java:57)\r\n\tat com.google.firebase.rules.tools.local.FirebaseRulesTooling.main(FirebaseRulesTooling.java:81)\r\n"}}
[info] i logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[error]
[error] Error: HTTP Error: 500, [object Object]
[debug] [2024-04-13T13:44:30.399Z] Error Context: {
"body": {
"error": {
"code": 500,
"status": "UNKNOWN"
}
},
"response": {
"statusCode": 500
}
}
Inspecting the java error shows the issue:
Unsupported eventType: google.cloud.firestore.document.v1.created.withAuthContext; Supported ones: [google.cloud.firestore.document.v1.created, google.cloud.firestore.document.v1.deleted, google.cloud.firestore.document.v1.updated, google.cloud.firestore.document.v1.written]
[REQUIRED] Steps to reproduce
As above
[REQUIRED] Expected behavior
Either:
- Warning in the emulator output that it is not supported and not load it and continue with emulating the rest
- Emulate the new Firestore triggers (Preferred)
[REQUIRED] Actual behavior
Errors are returned on emulator start. Have to disable new functions to get emulators to run.
Were you able to successfully deploy your functions?
Not relevant to this error as it relates to the emulators
Reacted by taichika, benomatis, JanKubicek and Luke Bordonaro
Activity
google-oss-bot commentedon Apr 13, 2024
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Bullfrog1234 commentedon Apr 13, 2024
This could also be an issue for firebase tools. Not sure. If so let me know and will raise it there.
benomatis commentedon Apr 21, 2024
I get the same error, despite importing the trigger like this:
I get the following error
For some reason it is trying to use Google Cloud Firestore triggers instead of Firebase Functions Firestore triggers despite the fact it's how it's been imported.
And I can confirm this is definitely an emulator problem only, the function otherwise deploys fine.
blidd-google commentedon Apr 24, 2024
Hi all, I've flagged the issue to the Firestore team and we should have support for the new auth context event types in the next release. Will update this thread once we've released support. Thanks for your patience!
Bullfrog1234 commentedon May 5, 2024
Any news on the timeline for this?
joehan commentedon May 7, 2024
@Bullfrog1234 This is in the works, we discovered some issues with our initial implementation that we're currently addressing. Unfortunately, due to upcoming code freezes for Google I/O, this will probably be a few more weeks we're able to ship it.
Bullfrog1234 commentedon May 8, 2024
@joehan Thanks for the update and understood about code freeze.
Seanitzel commentedon May 20, 2024
Would be great if you can put a note about it in the docs in the meantime, to save people's time :)
lukebordonaro commentedon May 28, 2024
Is there an ETA for when a release will be out? My use-case for wanting this support is I want to write unit tests for the functions that use Firebase Emulator (e.g.☹️
firebase emulators:exec --only firestore,functions "npm run test:functions"). Unfortunately, that's not possible if the emulator can't startbenbrunyee commentedon May 28, 2024
Are there any suggested alternatives for the time being?
Local development for my web app is paused until
firebase emulators:startworks.bytewiz commentedon May 28, 2024
Same issue here using
onDocumentWrittenWithAuthContextBullfrog1234 commentedon Jun 1, 2024
Hi @joehan,
I assume the code freeze is completed, so I am wishing for an update on this.
If the timeline is greater than 2 weeks from today can we follow @Seanitzel suggestion and add a note to the documentation. This will inform uses that this is not working in the emulators until it is fixed.
ohld commentedon Jul 29, 2024
Hi @Bullfrog1234,
I still have the same issue once I add a new function that uses
onDocumentWrittenWithAuthContext. Myfirebase-tools --versionversion is 13.14.2.When I run the emulators I see in the logs that firestore emulator is downgraded from 1.19.7 back to 1.19.6 which doesn't have a fix.
UPD:
Resolved by updating
firebase-toolspackage manually in allpackage.jsonfiles in the project.