firebase / firebase/functions-samples

functions-sample email-notifications contains call to changed() which is removed with v1.0.0

Open
#528 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
3.8k
Avg merge
3d 23h
Merged PRs (30d)
1

Description

Hi,
there is a small issue in one of the code examples where a beta library functionality is used. As mentioned on [so](https://stackoverflow.com/a/50111456/10516896) this should be updated.

### How to reproduce these conditions

**Sample name or URL where you found the bug**
https://github.com/firebase/functions-samples/blob/master/email-confirmation/functions/index.js

`// Sends an email confirmation when a user changes his mailing list subscription.
exports.sendEmailConfirmation = functions.database.ref('/users/{uid}').onWrite((change) => {
const snapshot = change.after;
const val = snapshot.val();

if (!snapshot.changed('subscribedToMailingList')) {
return null;
}
`

**Failing Function code used (including require/import commands at the top)**

**Steps to set up and reproduce**
N/A

**Sample data pasted or attached as JSON (not an image)**
N/A

**Security rules used**
N/A

### Debug output
N/A

### Expected behavior

Compare change.after and change.before instead of using the removed functionality.

### Actual behavior

The code sample uses functionality from the beta version of firebase-functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.