aws / aws/aws-cdk

(aws-lambda-python-alpha): The command "export" does not exist - Poetry

Open
#32,762 22 comments 23 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda-python bug effort/medium p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Our python poetry lambda deployments started failing with the error message `The command "export" does not exist`. I guess this is due to the recent poetry 2.0 release (https://github.com/python-poetry/poetry/releases/tag/2.0.0) that removes the export command and relies on the [poetry-plugin-export](https://github.com/python-poetry/poetry-plugin-export) plugin instead. The issue can be solved by using a custom build image that installs the plugin, this is the Dockerfile that worked for me: https://github.com/aws/aws-cdk/pull/32761/files.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

_No response_

### Expected Behavior

Lambda bundling succeeds.

### Current Behavior

Bundling fails with `The command "export" does not exist`

### Reproduction Steps

```typescript
new lambda.PythonLayerVersion(this, "TestLayer", {
entry: path.join(__dirname, "../layer"),
description: "Test Lambda Layer with Poetry dependencies",
compatibleRuntimes: [cdk.aws_lambda.Runtime.PYTHON_3_11],
});
```

### Possible Solution

Install plugin in build image, see https://github.com/aws/aws-cdk/pull/32761/files

### Additional Information/Context

_No response_

### CDK CLI Version

2.142.1

### Framework Version

_No response_

### Node.js Version

18.0.0

### OS

MacOS

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in the aws-lambda-python-alpha Poetry bundling path and reproduce the failure with the TypeScript example in the issue. Compare the build image Dockerfile linked from PR 32761, then verify that a Poetry 2.0 deployment completes successfully and that the existing bundling behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, python
Domain
build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.