Skip to content

Invoking the connector Lambdas

Runbook for ad-hoc runs: trigger an import outside the nightly schedule, or smoke-test a fresh image. Covers the McDonald's connector on both the dev and the prod lanes; the pattern is identical for Monoprix (swap the function name).

Prerequisites

  1. AWS account access. Ops provisions an IAM user named after your login in the woos-connectors member account (id 127262955926) and gives you initial console credentials. Sign in at https://127262955926.signin.aws.amazon.com/console, reset the password, then create an access key under IAM > Users > <you> > Security credentials.
  2. Tooling.
    brew install aws-vault awscli
    
  3. aws-vault profile. Store the access key:
    aws-vault add woos-connectors
    
    Then in ~/.aws/config:
    [profile woos-connectors]
    region = eu-west-1
    
  4. Sanity check.
    aws-vault exec woos-connectors -- aws sts get-caller-identity
    
    Expected: Account: 127262955926, user <your login>.

Function names

Lane Function
dev woos-connectors-mcdonalds-dev
prod woos-connectors-mcdonalds

Monoprix follows the same shape (woos-connectors-monoprix[-dev]).

Event payload

The Lambdas sit behind Mangum, so they expect a Lambda Function URL v2 event. Save this once under any path you like; the examples below use the session's scratchpad.

{
  "version": "2.0",
  "routeKey": "$default",
  "rawPath": "/api/stores/import/",
  "rawQueryString": "",
  "headers": {"content-type": "application/json"},
  "requestContext": {
    "accountId": "127262955926",
    "apiId": "manual",
    "domainName": "manual.lambda-url.eu-west-1.on.aws",
    "domainPrefix": "manual",
    "http": {
      "method": "GET",
      "path": "/api/stores/import/",
      "protocol": "HTTP/1.1",
      "sourceIp": "127.0.0.1",
      "userAgent": "aws-cli-manual"
    },
    "requestId": "manual",
    "routeKey": "$default",
    "stage": "$default",
    "time": "01/Jan/2026:00:00:00 +0000",
    "timeEpoch": 1767225600000
  },
  "isBase64Encoded": false
}

Reroute to a different handler by changing rawPath, requestContext.http.path and requestContext.http.method together.

To run a McDonald's import profile (?profile=staging), add both "rawQueryString": "profile=staging" and "queryStringParameters": {"profile": "staging"} to the event.

Invoke

Dev lane:

aws-vault exec woos-connectors -- aws lambda invoke \
  --function-name woos-connectors-mcdonalds-dev \
  --cli-binary-format raw-in-base64-out \
  --payload file://event.json \
  --region eu-west-1 \
  response.json \
  && cat response.json

Prod lane:

aws-vault exec woos-connectors -- aws lambda invoke \
  --function-name woos-connectors-mcdonalds \
  --cli-binary-format raw-in-base64-out \
  --payload file://event.json \
  --region eu-west-1 \
  response.json \
  && cat response.json

Expected on success:

{"statusCode": 200, "body": "{\"status\":\"ok\"}", "headers": {"content-type":"application/json; charset=utf-8", ...}, "isBase64Encoded": false}

The import is synchronous; the Lambda has a 540 s timeout, so the invoke call blocks until the connector finishes (or times out and the Slack notifier fires).

Tail logs

aws-vault exec woos-connectors -- aws logs tail \
  /aws/lambda/woos-connectors-mcdonalds-dev --since 10m --follow

Swap -dev for prod. CloudWatch retains log groups for 30 days.

Troubleshooting

  • AccessDeniedException on lambda:InvokeFunction → the aws-vault profile is not loaded; re-run through aws-vault exec woos-connectors -- and confirm aws sts get-caller-identity returns account 127262955926.
  • KeyError: 'sourceIp' in the response → the payload is missing fields Mangum needs. Use the template above, not a bare {}.
  • {"statusCode": 404, ...} → rawPath does not match a FastAPI route. The only handler on each connector is GET /api/stores/import/.