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

latest releases: v3.2.0, v3.1.0, v3.0.0...
4 months ago

Summary

This release improves Event Handler with (a) better serialization error for unsupported data types, and (b) middlewares are now triggered when a route is not found (404). We also crushed OpenAPI bugs for a smoother experience πŸͺ².

Thanks to @knightmre, Event Source Data Classes now features (a) updates Cognito User Pool User Migration event with verification link, and (b) new Pre-token generation and custom sender events.

🌟 ⭐ A big thank you to our new contributors: @knightmre, @phipag, @keithrozario, and @stevenhoelscher.

Event Handler middlewares are now triggered even when a route is not found (404)

Docs

You can now run middlewares even when a route is not found. Before, Event Handler immediately returned a HTTP 404 (Not Found). However, we learned from customers that key middleware logic should always run regardless, hence the fix.

This allows you to consistently perform cross-cutting concerns like logging, header injection, authorization, etc. even for invalid routes.

middleware

New CloudFormation Custom Resource Event Source Data Class

Docs

You can now use CloudFormationCustomResourceEvent for a better experience with type hinting and code completion support.

NOTE. We recommend customers to use CloudFormation Custom Resource Helper library to author custom resources.

Better error message for unsupported data types in Event Handler

Docs

We now raise a SerializationError when trying to serialize unsupported data types. Before, Event Handler did not distinguish between unsupported type or object altogether, like SQLAlchemy models.

You can bring your own custom serializer for additional data type support.

serialization_

Last but not least, we fixed an issue that occurred when disabling Idempotency using an environment variable. Thanks to @stevenhoelscher for this great catch.

Changes

🌟New features and non-breaking changes

  • feat(events): Update and Add Cognito User Pool Events (#4423) by @knightmre
  • feat(event_source): add CloudFormationCustomResourceEvent data class. (#4342) by @phipag

πŸ“œ Documentation updates

πŸ› Bug and hot fixes

  • fix(event_handler): do not skip middleware and exception handlers on 404 error (#4492) by @heitorlessa
  • fix(event_handler): raise more specific SerializationError exception for unsupported types in data validation (#4415) by @leandrodamascena
  • fix(event_handler): security scheme unhashable list when working with router (#4421) by @leandrodamascena
  • fix(idempotency): POWERTOOLS_IDEMPOTENCY_DISABLED should respect truthy values (#4391) by @stevenhoelscher
  • fix(event_handler): CORS Origin for ALBResolver multi-headers (#4385) by @leandrodamascena

πŸ”§ Maintenance

  • chore(deps): bump actions/checkout from 4.1.6 to 4.1.7 (#4493) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.87.5 to 0.87.6 (#4486) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.176 to 0.1.179 (#4488) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.144.0a0 to 2.145.0a0 (#4487) by @dependabot
  • chore(deps): bump datadog-lambda from 6.95.0 to 6.96.0 (#4489) by @dependabot
  • chore(deps): bump pydantic from 1.10.15 to 1.10.16 (#4485) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.144.0 to 2.145.0 (#4481) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.144.0 to 2.145.0 (#4482) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.175 to 0.1.176 (#4480) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.87.4 to 0.87.5 (#4479) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.6 to 3.0.7 (#4478) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.5.0 to 2.5.1 (#4469) by @dependabot
  • chore(deps): bump typing-extensions from 4.12.1 to 4.12.2 (#4470) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.174 to 0.1.175 (#4472) by @dependabot
  • chore(deps): bump datadog-lambda from 5.94.0 to 6.95.0 (#4471) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#4468) by @dependabot
  • chore(deps-dev): bump ijson from 3.2.3 to 3.3.0 (#4465) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.173 to 0.1.174 (#4466) by @dependabot
  • chore(deps): bump redis from 5.0.4 to 5.0.5 (#4464) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.25 to 9.5.26 (#4463) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.4.0 to 2.5.0 (#4462) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 8a87f05 to 96abcbb in /docs (#4461) by @dependabot
  • chore(deps-dev): bump ruff from 0.4.7 to 0.4.8 (#4455) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.169 to 0.1.173 (#4459) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.3.2 to 4.3.3 (#4456) by @dependabot
  • chore(deps): bump aws-xray-sdk from 2.13.1 to 2.14.0 (#4453) by @dependabot
  • chore(deps-dev): bump mypy-boto3-s3 from 1.34.105 to 1.34.120 in the boto-typing group (#4452) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.143.1a0 to 2.144.0a0 (#4448) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.3.1 to 2.4.0 (#4449) by @dependabot
  • chore(deps-dev): bump pytest from 8.2.1 to 8.2.2 (#4450) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.164 to 0.1.169 (#4442) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.143.1 to 2.144.0 (#4441) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.143.1 to 2.144.0 (#4443) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.5 to 3.0.6 (#4445) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#4444) by @dependabot
  • chore(deps): bump typing-extensions from 4.12.0 to 4.12.1 (#4440) by @dependabot
  • chore(deps-dev): bump ruff from 0.4.6 to 0.4.7 (#4435) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.143.0a0 to 2.143.1a0 (#4433) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.143.0 to 2.143.1 (#4429) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.143.0 to 2.143.1 (#4430) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.163 to 0.1.164 (#4428) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.161 to 0.1.163 (#4425) by @dependabot
  • chore(libraries): add jmespath as a required dependency (#4422) by @leandrodamascena
  • chore(deps-dev): bump ruff from 0.4.5 to 0.4.6 (#4417) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.87.3 to 0.87.4 (#4419) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.159 to 0.1.161 (#4420) by @dependabot
  • chore(deps-dev): bump coverage from 7.5.2 to 7.5.3 (#4418) by @dependabot
  • chore(deps-dev): bump mypy-boto3-dynamodb from 1.34.113 to 1.34.114 in the boto-typing group (#4416) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.24 to 9.5.25 (#4411) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.142.1a0 to 2.143.0a0 (#4410) by @dependabot
  • chore(deps-dev): bump mypy-boto3-dynamodb from 1.34.97 to 1.34.113 in the boto-typing group (#4409) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.158 to 0.1.159 (#4412) by @dependabot
  • chore(deps-dev): bump coverage from 7.5.1 to 7.5.2 (#4413) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 5358893 to 8a87f05 in /docs (#4408) by @dependabot
  • chore(deps): bump typing-extensions from 4.11.0 to 4.12.0 (#4404) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.142.1 to 2.143.0 (#4403) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.142.1 to 2.143.0 (#4402) by @dependabot
  • chore(deps-dev): bump ruff from 0.4.4 to 0.4.5 (#4399) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.2.1 to 2.3.1 (#4398) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.157 to 0.1.158 (#4397) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 2 updates (#4396) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.155 to 0.1.157 (#4394) by @dependabot
  • chore(deps): bump aws-encryption-sdk from 3.2.0 to 3.3.0 (#4393) by @dependabot
  • chore(deps-dev): bump mypy-boto3-cloudformation from 1.34.84 to 1.34.111 in the boto-typing group (#4392) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.154 to 0.1.155 (#4386) by @dependabot
  • chore(deps-dev): bump pytest-asyncio from 0.23.6 to 0.23.7 (#4387) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.2.0 to 2.2.1 (#4388) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.152 to 0.1.154 (#4382) by @dependabot
  • chore(deps): bump codecov/codecov-action from 4.4.0 to 4.4.1 (#4376) by @dependabot
  • chore(deps-dev): bump mypy-boto3-secretsmanager from 1.34.107 to 1.34.109 in the boto-typing group (#4378) by @dependabot
  • chore(deps): bump aws-xray-sdk from 2.13.0 to 2.13.1 (#4379) by @dependabot
  • chore(deps): bump requests from 2.31.0 to 2.32.0 (#4383) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.23 to 9.5.24 (#4380) by @dependabot
  • chore(deps-dev): bump pytest from 8.2.0 to 8.2.1 (#4381) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 48d1914 to 5358893 in /docs (#4377) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.141.0a0 to 2.142.1a0 (#4367) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.142.0 to 2.142.1 (#4366) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.150 to 0.1.152 (#4368) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#4369) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.87.2 to 0.87.3 (#4370) by @dependabot

This release was made possible by the following contributors:

@dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @heitorlessa, @keithrozario, @knightmre, @leandrodamascena, @phipag and @stevenhoelscher

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

NewReleases is sending notifications on new releases.