Skip to content

Bug: Suggested removal of docs breaks boto3 #7361

@Iamrodos

Description

@Iamrodos

Expected Behaviour

The latest release suggests adding this line to your build scripts.

# Remove documentation and examples
find build/ -name "docs" -type d -exec rm -rf {} +

If you include your own version of boto3 in your build, which I believe is recommend over relying on an unpinned version provided by lambda. You get the following error on importing boto3

{
    "timestamp": "2025-09-10T05:23:20Z",
    "log_level": "ERROR",
    "errorMessage": "Unable to import module 'lambda_web_function': No module named 'botocore.docs'",
    "errorType": "Runtime.ImportModuleError",
    "requestId": "",
    "stackTrace": []
}

I am not importing this, I am only importing

import boto3
from botocore.exceptions import ClientError

Current Behaviour

No error.

Code snippet

# Remove documentation and examples
find build/ -name "docs" -type d -exec rm -rf {} +

Possible Solution

Don't remove docs

Steps to Reproduce

See above

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.13

Packaging format used

Lambda Layers

Debugging logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentation

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions