Skip to content
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

change.after.val() / change.before.val() undefined #1633

Open
Granluke opened this issue Nov 5, 2024 · 1 comment
Open

change.after.val() / change.before.val() undefined #1633

Granluke opened this issue Nov 5, 2024 · 1 comment

Comments

@Granluke
Copy link

Granluke commented Nov 5, 2024

Related issues

[REQUIRED] Version info

node: v20.10.0

firebase-functions: 6.1.0

firebase-tools: 13.24.0

firebase-admin: ^6.1.0

[REQUIRED] Test case

exports.updateInvoice = functions.region('europe-west2').database.ref('/Invoice/Created/{invoiceKey}')
.onUpdate(async (change, context) => {
functions.logger.log("Updating Invoice", context.params.invoiceKey);
functions.logger.log("Updated snap", change.after.val());
functions.logger.log("change, context", change, context);
const snap_after_val = change.after.val();
functions.logger.log("Updated snap", snap_after_val);
const snap_before_v2 = change.before.val();
functions.logger.log("Updated change", change);
functions.logger.log("Updated change.before", change.before);
functions.logger.log("Updated change.after", change.after);
functions.logger.log("Updated change after._data", change.after._data);
functions.logger.log("Updated snap_before", snap_before_v2);
})

[REQUIRED] Steps to reproduce

when Updating a value in the snapshot, the function is triggered but not populating change.after.val() however it is populating change.after (it is a datasnapshot) See attached Logging)

[REQUIRED] Expected behavior

To get the snapshot value as a dict.

[REQUIRED] Actual behavior

image image

Were you able to successfully deploy your functions?

yes

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants