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

[lambda] specify multiple folders as a single lambda asset #21292

Closed
wants to merge 0 commits into from

Conversation

ahzia
Copy link

@ahzia ahzia commented Jul 22, 2022

Motivation: Right now in order to define a lambda function you need to set where the code resides, e.g. code: lambda.Code.asset('lambda'). Sometimes you would like to define multiple folders, for example, the actual code and node_modules, although packing can be done as a preprocessing step before actually running CDK deploy, it would be cleaner to do it as part of the lambda configuration.
Design aspect:
added a new function fromMultiAsset which takes an array of paths and archives it inside a zip file, then it calls AssetCode() and passes this new file.

closes #984

All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Jul 22, 2022

@github-actions github-actions bot added the p2 label Jul 22, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team July 22, 2022 17:37
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 and removed p2 labels Jul 22, 2022
@rix0rrr
Copy link
Contributor

rix0rrr commented Jul 22, 2022

I'm sorry, this is not what assets are for, and CDK is not a build tool. If you have a complex asset build step, write a shell script that will assemble your asset from your various source locations into a single directory, then reference that in your CDK app. Either that, or use the aws-lambda-nodejs module.

@rix0rrr rix0rrr closed this Jul 22, 2022
@ahzia
Copy link
Author

ahzia commented Jul 23, 2022

I'm sorry, this is not what assets are for, and CDK is not a build tool. If you have a complex asset build step, write a shell script that will assemble your asset from your various source locations into a single directory, then reference that in your CDK app. Either that or use the aws-lambda-nodejs module.

Thanks for your reply @rix0rrr
My solution was based on the issue #984 which is active since 2018 and many people have reached the same issue since then, it was labeled as P1 and feature/enhancement.
kindly take a look at the issue.

@kellertk
Copy link
Contributor

kellertk commented Aug 1, 2022

@rix0rrr If we don't want to implement this we should close #984 as well. It's one of the more upvoted and reacted on feature requests.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 5515ce4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@ahzia
Copy link
Author

ahzia commented Aug 17, 2022

Closed this and opened a new Pull for this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[lambda] specify multiple folders as a single lambda asset
4 participants