Integration guides

AWS Lambda

Complete path for a Node.js function on AWS Lambda behind a function URL or API Gateway.

aws-lambda/ of the examples repo: one Node.js 20 function without dependencies, behind a Lambda Function URL or an API Gateway HTTP API (payload format 2.0). Routes as in the Go guide. Files in src/: handler.js (routing, login stub: it reads the sub claim of an API Gateway JWT authorizer), limenia.js, signature.js (same as Node.js), events.js, actions.js (placeholders), event-store.js (memory or DynamoDB via LIMENIA_EVENTS_TABLE), device-ticket.js.

Shell
cd limenia-examples/aws-lambda && npm test && npm run package   # function.zip

Things specific to Lambda

  • Lambda can hand over the body base64-encoded: decode event.body with event.isBase64Encoded before verifying the signature (rawBody(event) in handler.js).
  • API Gateway ends requests after 30 s, so the example uses a 12 s timeout, two attempts and waits at most 5 s for Retry-After; longer waits go back to the app.
  • Load LIMENIA_API_KEY and LIMENIA_WEBHOOK_SECRET from AWS Secrets Manager or SSM Parameter Store in production; plain Lambda environment variables are visible to anyone who can read the function configuration.