Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3-assets: local bundling does not work #26581

Open
rittneje opened this issue Aug 1, 2023 · 4 comments
Open

s3-assets: local bundling does not work #26581

rittneje opened this issue Aug 1, 2023 · 4 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@rittneje
Copy link

rittneje commented Aug 1, 2023

Describe the bug

aws_cdk.BundlingOptions has a property local that we can use to define a "local" bundler instead of routing through docker. However, it is broken.

First, the Python docs show the completely wrong signature for ILocalBundling.try_bundle:

try_bundle(output_dir, *, image, bundling_file_access=None, command=None, entrypoint=None, environment=None, local=None, network=None, output_type=None, platform=None, security_opt=None, user=None, volumes=None, volumes_from=None, working_directory=None)

In reality, the signature needs to be the same as in TypeScript:

try_bundle(self, output_dir: str, options: aws_cdk.BundlingOptions) -> bool:

Even after getting through that issue, it seems that the local bundling concept was not designed properly. None of the input parameters tell you what you are intending to bundle. With docker I believe that comes through as the working directory, but the local bundler gets nothing. The working directory (at least on the Python side) is not changed, and there is no parameter for it either. So essentially the only way to do it is to make a separate bundler instance for each aws_lambda.Code.from_asset invocation, and duplicate the path in its constructor. It is also unclear to me how any of this is intended to work with the exclude and follow_symlinks parameters since they don't come through either.

I will also point out the documentation around local bundling is extremely inadequate. https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_s3_assets/README.html#asset-bundling

Expected Behavior

The Python docs should be accurate. The local bundling feature should be properly designed and tested, with relevant documentation available.

Current Behavior

Does not work in any reasonable sense.

Reproduction Steps

Try to use it.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.85.0 (build 4e0d726)

Framework Version

No response

Node.js Version

v18.16.1

OS

Alpine 3.18

Language

Python

Language Version

Python 3.11.4

Other information

No response

@rittneje rittneje added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 1, 2023
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Aug 1, 2023
@pahud
Copy link
Contributor

pahud commented Aug 1, 2023

Thank you for your report. I believe the local bundling is still very experimental and we appreciate any PR to improve that.

@pahud pahud added p2 effort/medium Medium work item – several days of effort labels Aug 1, 2023
@pahud pahud changed the title aws_cdk: local bundling does not work s3-assets: local bundling does not work Aug 1, 2023
@pahud pahud removed the needs-triage This issue or PR still needs to be triaged. label Aug 1, 2023
@rittneje
Copy link
Author

rittneje commented Aug 1, 2023

@pahud if it’s experimental, will breaking changes to the ILocalBundling interface be accepted to make it usable?

@rittneje
Copy link
Author

@pahud

@jwshyns
Copy link

jwshyns commented Oct 25, 2023

I second the concerns of @rittneje - this functionality has been available in this non-working state for quite some time without a crumb of documentation alluding to the fact it's experimental or that there are known limitations or issues. Short of fixing this functionality, it would be great to see any mention of these issues in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants