Installation
Basic Setup
Initialize Sentry
Initialize Sentry at the top of your function file:Function Types
HTTP Functions
Wrap HTTP functions withwrapHttpFunction:
Background Functions
Wrap background (event-driven) functions withwrapEventFunction:
CloudEvents
Wrap CloudEvent functions withwrapCloudEventFunction:
Error Handling
HTTP Function Errors
Background Function Errors
Performance Monitoring
Custom Spans
External API Calls
Context and Tags
Function Context
User Identification
Firebase Integration
Firestore Triggers
Pub/Sub Triggers
Environment Variables
Configure using environment variables:Cloud Run
For Cloud Run deployments:Terraform Deployment
Configure with Terraform:Best Practices
Wrap Functions
Always wrap your functions with appropriate Sentry wrapper.
Set Context
Add function and event context for better debugging.
Handle Retries
Consider retry logic when reporting errors in event functions.
Environment Config
Use environment variables for configuration.
Troubleshooting
Events Not Captured
Events Not Captured
Ensure:
- Function is wrapped with appropriate wrapper
- SENTRY_DSN is configured
- Function has internet access
- Errors are being thrown or captured
Timeout Issues
Timeout Issues
Consider:
- Increase function timeout
- Use async error reporting
- Ensure Sentry.flush() is called before exit
Next Steps
Firestore
Track Firestore operations
Pub/Sub
Monitor message processing
Cloud Run
Deploy containerized applications
Firebase
Integrate with Firebase services