LocalStackAWS Lambda

Lambda execution environment timeout during startup with boto3 and hot-reload

critical
Connection ManagementUpdated Mar 30, 2025(via Exa)
How to detect:

Lambda function with hot-reload enabled times out during startup when boto3 client is initialized. The execution environment fails to complete initialization within LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT (default ~50 seconds), causing the container to restart multiple times before failing with INTEGRATION_FAILURE.

Recommended action:

1) Check Lambda container logs for startup errors. 2) Verify network connectivity between Lambda container and LocalStack instance - Lambda must be able to reach the LOCALSTACK_HOSTNAME endpoint. 3) Remove LAMBDA_DOCKER_NETWORK from docker-compose configuration (LocalStack auto-detects the correct network including docker-compose project prefix). 4) If the issue persists after network fixes, increase LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT beyond the default.