-
Notifications
You must be signed in to change notification settings - Fork 918
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
Improve error message when invalid Firestore document path is specified in Firestore trigger definitions #4284
Comments
I upgraded to firebase-tools@10.2.2 yesterday. Downgraded back to 10.1.1 now, and it looks to be working. Is there an issue with the newest version(s)? Edit: No, that wasn't it. When I rebuilt with another function and a new function was found, the first function failed again. |
Tentaively moving the issue to Firebase CLI repo - it looks like the bug might be w/ the Firestore Emulator. |
Believe it or not, this actually has more to do with your Firestore triggers than the Admin SDK. Thanks for posting the complete logs, and I was able to find this in the logs:
However, we should provide a better error message since now we've seen it twice (after #3136). @taeold Is there anyway we can validate this in the Functions SDK before passing it on to the Firestore Emulator? And/or, the Firestore Emulator should validate this at trigger creation time (before subsequent data requests), which will also make it less misleading. |
@yuchenshi Thanks for finding the root cause - and yes I think validating trigger path is a great feature request, just something we didn't have time to implement yet. Overall, do you know how the trigger validation might work? Can it be just a fancy regex or is there a better way? |
@yuchenshi Thank you! I wasn't able to find this myself, was looking in completely the wrong place. I do agree the error message could be a bit clearer if possible. |
@taeold The Firestore Emulator uses an internal (non-opensource) library function for validation, but I think the format is straightforward to validate with regex as well. Essentially, we just need to make sure the curly brackets match and cannot nest. |
We're building a Firebase Extension, and I'm also seeing a similar error but as far as I can tell my Firestore trigger path is valid. I think the issue is related to the extension parameter substitution. Path:
Error from
|
Wasn't really sure what to label this, so feel free to change it to something clearer.
Related issues
Related, closed issue from 2018 fixed by fix of bug in grpc: firebase/firebase-functions#536 .
[REQUIRED] Version info
Versions:
node: 16.13.0
firebase-functions: 3.18.1
firebase-tools: 10.2.2 (Also happened with 10.1.2)
firebase-admin: 10.0.2
[REQUIRED] Test case
index.ts
(looks mostly the same transpiled).[REQUIRED] Steps to reproduce
firebase emulators:start
.http://localhost:5001/{projectId}/{location}/default
[REQUIRED] Expected behavior
The collection "test" should have a document "test" with a value "test":true in it.
[REQUIRED] Actual behavior
Sporadically, it seems to work, this might have something to do with cold starts? I don't know how that works on the emulator.
The logged exception:
The error message showing up in firestore-debug.log:
I can see that it expects an ending bracket
}
, but I can't figure out where it expects it.Were you able to successfully deploy your functions?
Don't know if this is relevant, when I can't run them locally.
I've also attached my complete logs, but I'm pretty sure I've pasted the relevant parts.
firebase-debug.log
firestore-debug.log
The text was updated successfully, but these errors were encountered: