Skip to main content
PayPulse Cloud uses 13 Lambda functions written in Python 3.12. They are organized into three groups: auth, users, and invoices.

Function reference

get_rental_invoice is deployed and reachable at GET /v1/invoices/{type}/{invoice_id} but is not currently called by the iOS app.

Lambda layers

Shared dependencies are distributed as Lambda layers so each function only packages its own logic.

utils-layer

The common utilities layer contains all shared Python modules used across multiple functions: To update the layer, regenerate lambda_layers/common/utils_layer.zip and run terraform apply.

pyjwt-layer

Contains the PyJWT package. Attached to functions that issue or validate JWT tokens.

bcrypt-layer

Sourced from Klayers — a community-maintained repository of pre-built Lambda layer ARNs. Attached to signup_user and login_user for password hashing.

google-api-layer

Contains the Google API Python client library. Attached to functions that call the Gmail API (fetch_invoices, fetch_latest_invoice, fetch_retail_invoices, gmail_store_tokens).

gemini-parsers-layer

Contains Google Gemini client libraries and per-category parser classes used by parse_retail_invoice for AI-assisted retail invoice parsing. Parsers are available for: food delivery, clothing, technology, subscriptions, grocery, utility, miscellaneous, and travel sub-types.

Deployment methods

Zip upload to S3

Most functions are packaged as ZIP archives and stored in the Lambda functions S3 bucket. Terraform reads the object version from S3 and updates the Lambda function when a new version is uploaded.
To redeploy a ZIP-based function:
  1. Update the source code.
  2. Rebuild the ZIP and upload it to the Lambda functions S3 bucket.
  3. Run terraform apply — Terraform detects the new S3 object version and updates the function.

Docker image to ECR (parse_invoice only)

parse_invoice uses a Docker image published to Amazon ECR. This is because its PDF parsing dependency (HyresaviParser) and its transitive requirements exceed the 250 MB unzipped Lambda limit.
To redeploy parse_invoice:
  1. Build a new Docker image from lambdas/invoices/parse_invoice/Dockerfile.
  2. Tag and push to ECR.
  3. Update image_uri in lambda_parse_invoice.tf with the new tag.
  4. Run terraform apply.
The ECR image tag in lambda_parse_invoice.tf must be updated manually on every build. Forgetting this step means Terraform will not re-deploy the function.