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

Detect changes in eventTrigger definitions #3557

Merged
merged 3 commits into from
Jul 8, 2021
Merged

Detect changes in eventTrigger definitions #3557

merged 3 commits into from
Jul 8, 2021

Conversation

samtstern
Copy link
Contributor

Description

Fixes #2533

Scenarios Tested

  1. Create a function exports.firestoreFn = functions.firestore.document('/test/{doc}').onWrite(...)
  2. Write a doc in /test the emulator UI, see that the function executes
  3. Change the trigger to be functions.firestore.document('/test2/{doc}')
  4. Write a doc in /test, nothing happens.
  5. Write a doc in /test2, see exactly one execution.

Logs:

$ firebase --project=demo-project-12345  emulators:start
i  emulators: Starting emulators: functions, firestore
i  emulators: Detected demo project ID "demo-project-12345", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.
i  firestore: Firestore Emulator logging to firestore-debug.log
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/private/var/folders/xl/6lkrzp7j07581mw8_4dlt3b000643s/T/tmp.bH599aKP/functions" for Cloud Functions...
✔  functions[us-central1-firestoreFn]: firestore function initialized.

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://localhost:4000                │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator  │ Host:Port      │ View in Emulator UI             │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ localhost:5001 │ http://localhost:4000/functions │
├───────────┼────────────────┼─────────────────────────────────┤
│ Firestore │ localhost:8080 │ http://localhost:4000/firestore │
└───────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at localhost:4400
  Other reserved ports: 4500

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
 
i  functions: Beginning execution of "us-central1-firestoreFn"
>  test/qJN4KLuFOJItu0iIUjcK
i  functions: Finished "us-central1-firestoreFn" in ~1s
✔  functions[us-central1-firestoreFn]: firestore function initialized.
i  functions: Beginning execution of "us-central1-firestoreFn"
>  test2/6FyUaaYWMaILYtXwb3vK
i  functions: Finished "us-central1-firestoreFn" in ~1s

Sample Commands

N/A

@samtstern samtstern requested a review from yuchenshi July 7, 2021 14:30
@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Jul 7, 2021
Copy link
Member

@yuchenshi yuchenshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we can get an e2e test?

@samtstern
Copy link
Contributor Author

@yuchenshi getting a meaningful and reliable e2e test would not be possible in our current test setup because it would require modifying functions source files to hit the file watcher.

@yuchenshi
Copy link
Member

yuchenshi commented Jul 7, 2021

All right, let's go for it without automated tests then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected onCreate behavior after changing collection path and hot reload
2 participants