Server-side logic.
WHAT THEY PROVIDE
Code executed in response to events or requests, without managing servers.
WHAT TRIGGERS EXIST
Document changes Authentication events Storage uploads Scheduled execution Direct calls from clients Web requests
WHAT TO USE THEM FOR
Anything a client must not be trusted to do Maintaining denormalised data Integrating with external services Processing uploads Scheduled work
WHAT TO BE CAREFUL WITH
Functions triggered by writes that themselves write to the same collection.
WHY
It creates a loop, which runs until something stops it, billing throughout.
WHAT TO DO ABOUT IT
Check whether the change requires action before acting.
WHAT TO HANDLE
Functions running twice, since delivery guarantees permit it.
WHAT THAT REQUIRES
Operations safe to repeat.
WHAT TO CONFIGURE
Memory and timeout appropriate to the work Maximum instances, as a cost control Minimum instances, where cold start latency matters
WHAT TO KEEP OUT OF FUNCTIONS
Secrets in code. Use the secret manager.
WHAT TO MONITOR
Invocation counts, errors and duration.