Execution Environment
Cloud functions execute in a secure Python environment with access to these pre-injected globals — no imports needed:| Global | Description |
|---|---|
| req | Request object (params, payload, headers, user) |
| db | Database service (queries, CRUD, relationships) |
| http | HTTP client (external API requests) |
| auth | Authentication service (JWT tokens) |
| render | Template renderer (HTML with Jinja2) |
| use() | Module system (import other functions) |
| queue | Background tasks (non-blocking execution) |
| config | Project configuration and cron payloads |
| Email service (send emails) |
Request Object (req)
Database (db)
HTTP Client (http)
Authentication (auth)
Template Rendering (render)
Module System (use())
Queue (queue)
Configuration (config)
Available Standard Library Modules
- json — JSON encoding/decoding
- datetime, timedelta — Date and time
- math — Mathematical functions
- re — Regular expressions
- random — Random number generation
- secrets — Cryptographically secure random
- time — Time utilities
- hashlib — Hash functions
- uuid — UUID generation
- base64 — Base64 encoding/decoding
- urllib — URL parsing
- collections — Counter, defaultdict
- itertools — Iterator functions
- functools — Higher-order functions
- decimal — Decimal precision
- statistics — Statistical functions
- dataclasses — Dataclasses
WebSocket Globals
WebSocket functions have additional objects:Security & Sandboxing
Not available in cloud functions:- File system access (open, os.listdir)
- System commands (os.system, subprocess)
- Network sockets (use http instead)
- Process manipulation
- Safe built-ins (len, str, int, dict etc.)
- Standard library modules listed above
- HTTP requests via http object
- Database access via db object
Timeouts
| Operation | Timeout |
|---|---|
| Function execution | 20 seconds |
| HTTP requests | 10 seconds |
| Database queries | No explicit limit |
