Skip to content

Slow invocation of the client causes a timeout in AWS Lambda #1799

@danrossi

Description

@danrossi

Describe the bug

I see a previous package import improvement for lazy loading. However my lambda function is failing due to a 3sec timeout invoking the stripe client not when importing the package.

client = stripe.StripeClient(stripe_api_key)

Just setting up the client requires to increase the Lambda function timeout to 6 seconds from 3 seconds. I am not sure how far back it broke as I just updated the library package layer and migrated to the client setup.

A response from a test.

Response:
{
  "errorMessage": "2026-04-27T12:13:45.810Z 154892f8-280d-4473-849b-d29648da8586 Task timed out after 3.02 seconds"
}

I need to increase the timeout to 10 seconds. Its been a default of 3 seconds for years.

To Reproduce

  1. invoke the client. client = stripe.StripeClient(stripe_api_key)

Expected behavior

Not timeout the lambda function.

Code snippets

import stripe
def lambda_handler(event, context):
 client = stripe.StripeClient(stripe_api_key)

OS

Linux

Language version

Python 3.14

Library version

latest

API version

latest

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions