You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the release of Poetry 1.8.3, the Lambda functions can't import the generated runtime modules because they are no longer getting packaged in the zip file.
Expected Behavior
The generated runtime modules are successfully imported when executing the handlers in Lambda.
Current Behavior
[ERROR] Runtime.ImportModuleError: Unable to import module 'api_detective_api_python_handlers.generate_spec': No module named 'api_detective_api_python_runtime'
Locally, it works when I run pytest. However, it looks like the asset in cdk.out installs the runtime package with a pointer to the source path.
Reproduction Steps
Install poetry 1.8.3. Build and deploy a project with a type-safe-api project with Python handlers.
Possible Solution
A workaround would be to use sed to strip the '-e' flag from the exported requirements.txt according to pypa/pip#4812
Fixes the issue where generated runtime modules were not packaged
in the Lambda deployment, causing ImportModuleError when executing
Python handlers.
The fix modifies the packaging task in GeneratedPythonHandlersBaseProject
to strip the '-e' flag from exported requirements.txt. This ensures runtime
modules are installed as regular packages instead of editable installations.
Changes:
- Update 'poetry export' command to pipe output through 'sed' and remove
'-e' prefix.
- Update corresponding snapshot tests for new package task command.
Fixesaws#791
Fixes the issue where generated runtime modules were not packaged
in the Lambda deployment, causing ImportModuleError when executing
Python handlers.
The fix modifies the packaging task in GeneratedPythonHandlersBaseProject
to strip the '-e' flag from exported requirements.txt. This ensures runtime
modules are installed as regular packages instead of editable installations.
Changes:
- Update 'poetry export' command to pipe output through 'sed' and remove
'-e' prefix.
- Update corresponding snapshot tests for new package task command.
Fixes#791
Co-authored-by: Adrian Dimech <51220968+agdimech@users.noreply.github.com>
Describe the bug
Since the release of Poetry 1.8.3, the Lambda functions can't import the generated runtime modules because they are no longer getting packaged in the zip file.
Expected Behavior
The generated runtime modules are successfully imported when executing the handlers in Lambda.
Current Behavior
Locally, it works when I run pytest. However, it looks like the asset in cdk.out installs the runtime package with a pointer to the source path.
Reproduction Steps
Install poetry 1.8.3. Build and deploy a project with a type-safe-api project with Python handlers.
Possible Solution
A workaround would be to use sed to strip the '-e' flag from the exported requirements.txt according to pypa/pip#4812
Additional Information/Context
The latest version of poetry fixed a bug regarding editable installs: python-poetry/poetry-plugin-export#145 .
PDK version used
0.23.38 and 0.23.40
What languages are you seeing this issue on?
Typescript, Python
Environment details (OS name and version, etc.)
MacOS 14.4.1 intel
The text was updated successfully, but these errors were encountered: