Version comparison

order-processor v0001→v0002

2 added, 2 modified, 9 renamed, 55 vendored
v0001archived 2026-10-08 00:30 v0002archived 2026-10-08 00:30

What changed

AI summary

Saved orders are now also sent to SQS, and config.py ships hardcoded AWS and Stripe keys

lambda_handler now publishes every accepted order to the queue named by the new QUEUE_URL environment variable, right after put_order writes it to DynamoDB, and rejects orders with more than MAX_ITEMS (50) items with a 422. New orders are stored with "status": "PENDING". The config.py that supplies MAX_ITEMS also hardcodes an AWS access key ID and a Stripe API key and sets DEBUG = True, so this package should not be deployed as it stands.

Changes 6

  1. Accepted orders are published to SQS

    After put_order saves the order, lambda_handler sends the whole order as JSON to QUEUE_URL with sqs.send_message, so a downstream consumer can pick it up for fulfilment.

    feature
  2. Orders with more than MAX_ITEMS items are rejected with 422

    An order with over 50 items now gets 422 {"error": "too many items"} before anything is written. Callers that used to get 201 for large orders will now get an error.

    behaviour
  3. New orders are stored with status PENDING

    put_order adds "status": "PENDING" to every item it writes, so new records carry a field that older records in the table do not.

    behaviour
  4. config.py hardcodes an AWS access key and a Stripe key

    AWS_ACCESS_KEY_ID and STRIPE_API_KEY are string literals in the deployment package, next to DEBUG = True. The file's own TODO says they belong in Secrets Manager.

    security
  5. db.py moved into a helpers package

    db.py is now helpers/db.py, with an empty helpers/__init__.py, and the import in lambda_function.py follows it. No behaviour change beyond the new status field.

    refactor
  6. boto3 and botocore upgraded to 1.35.20; pydantic 2.9.0 added

    requirements.txt and the installed packages agree. None of the changed files shown import pydantic, so it adds size without a visible use yet.

    dependency
High risk

The package commits two credentials, and every invocation fails at import if QUEUE_URL is not set.

Deploy checklist

What could go wrong 5

  • Credentials committed to the deployment package (high risk)

    Anyone who can download this function's code can read the AWS access key ID and the Stripe key in config.py. Treat both as exposed: rotate them, and load them from Secrets Manager or encrypted environment variables instead.

  • Every invocation fails if QUEUE_URL is not set (high risk)

    QUEUE_URL is read with os.environ["QUEUE_URL"] at import time, so a missing variable raises KeyError during the cold start and the function fails before lambda_handler runs. Set it before deploying.

  • Execution role needs sqs:SendMessage (medium risk)

    boto3.client("sqs") is new. Without sqs:SendMessage on the queue, send_message raises after put_order has already saved the order, so the caller sees an error for an order that was stored and nothing reaches the queue.

  • Orders over 50 items now fail with 422 (medium risk)

    Clients that send larger orders will start getting errors where they used to succeed. Check whether any real orders exceed MAX_ITEMS before deploying.

  • DEBUG = True ships in config.py (low risk)

    Nothing in the changed code reads DEBUG yet, but it is switched on in what would be a production package.

Written by claude-opus-5-5 (Anthropic) on 2026-10-08 00:30 · from all 5 changed files · 2 credential-like values redacted before sending. AI can be wrong — the diffs below are the record.lw explain order-processor --from 1 --to 2 --refresh
13
files changed
+24−5
lines
3
dependencies
9.2 KB+886 B
package size
3
new findings
55
vendored files not shown

New findings

3values are redacted
severitykindwheredetail
highaws-access-key-idconfig.py:6AKIA…LE (20 chars)
highstripe-keyconfig.py:7sk_l…dc (32 chars)
lowdebug-flagconfig.py:8DEBUG = True

Before you deploy

configuration impact
Environment variables addedQUEUE_URL
These must exist in the function's environment configuration before you deploy.
AWS services addedsqs
The execution role may need new IAM permissions.

Dependencies

3
changepackageversionsource
addedpydantic2.9.0pip · installed
changedboto31.34.0→1.35.20pip · installed
changedbotocore1.34.0→1.35.20pip · installed

File changes

13click a file to open its diff