github aws-powertools/powertools-lambda-python v2.17.0

latest releases: v3.0.0, v2.43.1, v2.43.0...
15 months ago

Summary

This release is full of new features and important bug fixes:

  • we now treat missing idempotency keys as non-idempotent transactions (no-op)
  • we now proritize the most specific route in event handler
  • new event source data classes for Amazon VPC Lattice Events and AWS Config Rules
  • new parser support for CloudFormation Custom Resources
  • better typing support when bringing your own Logger formatter
  • tons of documentation fixes and improvements

⭐ Huge thanks to new contributors: @abbasyadollahi @erikayao93 and @stephenbawks!

Idempotency

We now handle scenarios where the idempotency key might be optional by skipping the persistence storage layer operations (CRUD).

Here’s an example where uniqueness is dictated by X-Idempotency-Key header, but it might be optional:

carbon (9)

Imagine we have three disctinct requests, where the headers key looks like this:

  • First request: {"headers": {"X-Idempotency-Key": "7ca32179-f88f..."}}
  • Second request: {"headers": {}}
  • Third request: {"headers": {}}

With this fix, the first request will follow the current idempotency mechanism while the second and third request will not trigger any idempotency mechanism to prevent unwanted side effects (e.g., idempotency key of None is hashed).

Prioritizing most specific routes in event handler

We made a significant change in the way routes are matched on the event handler by giving priority to the most specific routes.

Consider the following code:

carbon (10)

With this fix, a GET request to /studies/fetch will now match the fetch_studies handler, even though it was declared last.

Support for VPC Lattice and AWS Config Rule events

Docs: Amazon VPC Lattice, AWS Config Rules

We made it easier to work with events comming from Amazon VPC Lattice and AWS Config Rules.

carbon (11)

carbon (12)

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(idempotency): treat missing idempotency key as non-idempotent transaction (no-op) when raise_on_no_idempotency_key is False (#2477) by @leandrodamascena
  • fix(event_handler): prioritize static over dynamic route to prevent order of route registration mismatch (#2458) by @rubenfonseca

🔧 Maintenance

  • chore(deps-dev): bump mkdocs-material from 9.1.15 to 9.1.16 (#2470) by @dependabot
  • chore(deps-dev): bump flake8-comprehensions from 3.12.0 to 3.13.0 (#2471) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.77.8 to 0.77.9 (#2472) by @dependabot
  • chore(deps): bump aws-actions/configure-aws-credentials from 2.1.0 to 2.2.0 (#2469) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.83.1 to 2.84.0 (#2460) by @dependabot
  • chore(deps-dev): bump mypy-boto3-s3 from 1.26.127 to 1.26.153 (#2452) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.77.7 to 0.77.8 (#2451) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 2.6.0 to 2.7.0 (#2450) by @dependabot
  • feat(logger): type log record in LambdaPowertoolsFormatter with TypedDict (#2419) by @erikayao93
  • chore(deps-dev): bump pytest from 7.3.1 to 7.3.2 (#2443) by @dependabot
  • chore(deps-dev): bump filelock from 3.12.0 to 3.12.2 (#2446) by @dependabot
  • chore(deps-dev): bump ijson from 3.2.0.post0 to 3.2.1 (#2441) by @dependabot
  • chore(deps-dev): bump mypy-boto3-dynamodb from 1.26.115 to 1.26.152 (#2444) by @dependabot
  • chore(deps): bump actions/checkout from 3.5.2 to 3.5.3 (#2431) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.83.0 to 2.83.1 (#2432) by @dependabot
  • docs(navigation): standardize link targets to enhance customer experience (#2420) by @leandrodamascena
  • chore(deps-dev): bump cfn-lint from 0.77.6 to 0.77.7 (#2414) by @dependabot
  • chore(deps): bump pydantic from 1.10.8 to 1.10.9 (#2405) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.25.0 to 1.25.1 (#2408) by @dependabot
  • chore(deps-dev): bump mypy-boto3-cloudformation from 1.26.147 to 1.26.149 (#2410) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.82.0 to 2.83.0 (#2406) by @dependabot
  • chore(deps-dev): bump mypy-boto3-logs from 1.26.53 to 1.26.149 (#2409) by @dependabot
  • chore(deps): bump docker/setup-qemu-action from 2.1.0 to 2.2.0 (#2404) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 2.5.0 to 2.6.0 (#2403) by @dependabot
  • docs(maintainers): visual representation of release process (#2399) by @heitorlessa
  • chore(ci): fix PR labeling permission scope (#2396) by @heitorlessa
  • chore(ci): document all github action workflows and enforce least-privilege (#2395) by @heitorlessa

This release was made possible by the following contributors:

@abbasyadollahi, @dependabot, @dependabot[bot], @erikayao93, @github-actions, @github-actions[bot], @heitorlessa, @leandrodamascena, @ran-isenberg, @rubenfonseca and @stephenbawks

Don't miss a new powertools-lambda-python release

NewReleases is sending notifications on new releases.