You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import * as functions from 'firebase-functions';
export let test = functions
.database
.ref('/test/{id}')
.onWrite((event, context) => console.log(event.after.child('nested/property').val()));
[REQUIRED] Steps to reproduce
Insert any value to realtime database at /test/123/whatever
[REQUIRED] Expected behavior
Calling event.after.child('nested/property').val()) should return null (as it does prior to v4)
[REQUIRED] Actual behavior
TypeError: Cannot read properties of null (reading 'property') at DataSnapshot.val (/workspace/node_modules/firebase-functions/lib/common/providers/database.js:104:32)
Were you able to successfully deploy your functions?
Yes, this is a runtime error.
Footnote
Since the v4 rewrote the exists() as a check to the result of val() it is also affected. And it's really not clear to me how else to check if the nested property exists.
The text was updated successfully, but these errors were encountered:
Related issues
This is related to v4 changes here: https://github.com/firebase/firebase-functions/blame/c0fffcc47dee5cca93683f745b619c0d95cf7339/src/common/providers/database.ts#L123
[REQUIRED] Version info
node: v16.15.0
firebase-functions: 4.4.1
firebase-tools: 12.4.0
firebase-admin: 10.2.0
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
Insert any value to realtime database at
/test/123/whatever
[REQUIRED] Expected behavior
Calling
event.after.child('nested/property').val())
should returnnull
(as it does prior to v4)[REQUIRED] Actual behavior
Were you able to successfully deploy your functions?
Yes, this is a runtime error.
Footnote
Since the v4 rewrote the
exists()
as a check to the result ofval()
it is also affected. And it's really not clear to me how else to check if the nested property exists.The text was updated successfully, but these errors were encountered: