-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-lambda-pythonbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1
Description
If a handler function is located in a subdirectory of the lambda code package, the aws_lambda.Function handler property is set to an incorrect value by this line of code in aws-lambda-python/lib/function.ts:
handler: `${index.slice(0, -3)}.${handler}`,
Reproduction Steps
- Create a python lambda code package where a handler function is not in the root directory of the package. Example
root/
--- main_file.py
--- handlers/
------ __init__.py
------ my_handler.py
--- lib/
------ __init__.py
------ other_python_code.py
- Then deploy a CDK stack containing a PythonFunction construct using this handler. Example:
from aws_cdk import aws_lambda_python as lambda_python
lambda_python.PythonFunction(
self, 'ExampleFunction',
entry="../root",
handler="handle_lambda",
index="handlers/my_handler.py")What did you expect to happen?
A lambda function should be deployed with the handler property set to handlers.my_handler.handle_lambda
What actually happened?
A lambda function was deployed with the handler property set to handlers/my_handler.handle_lambda
Environment
- **CDK CLI Version : 1.107.00
- **Framework Version: 1.107.0
- **Node.js Version: v12.8.3
- **OS : macos
- **Language (Version): Python 3.8.5
Other
The index.slice string substitution should replace / characters with . characters.
This is 🐛 Bug Report
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-lambda-pythonbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1