question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[lambda] specify multiple folders as a single lambda asset

See original GitHub issue

Hello, Great framework, keep up the good work.

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 preprocess step before actually running cdk deploy, it would be cleaner to do it as part of the lambda configuration.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:27
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

14reactions
justinmchasecommented, Dec 6, 2018

I have a mono-repo and so I can’t just include the root of the project. I use tsc to compile code from src/ -> dist/, from ts to js. My node_modules exists at the root of the project and I don’t want to include all dependencies even.

Something like this would be great:

    const example = new Function(this, 'Example'), {
      runtime: Runtime.NodeJS810,
      handler: 'index.handler',
      code: Code.files([
        'dist/funcs/example/*',
        'node_modules/*'
        '!node_modules/aws-sdk'
    });

Similar to the way gulp would let you include src files.

Right now I’m looking at adding a package.json into my func folder and running npm i --production but its a bit of a pain, I don’t have any mechanism for copying non-code files currently.

10reactions
nija-atcommented, Oct 18, 2019

still relevant

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for working with AWS Lambda functions
Initialize SDK clients and database connections outside of the function handler, and cache static assets locally in the /tmp directory. Subsequent invocations ...
Read more >
Serverless Framework Python 1 yml and multiple directories ...
The issue is that the whole functions/* folder is picked up by each of the lambdas even if I have something like this...
Read more >
5 Ways To Bundle a Lambda Function Within an AWS CDK ...
Bundle Lambda Function Before Publishing · Make sure the lambda/build folder is not ignored by NPM (this is usually configured in . ·...
Read more >
How to Create an AWS Lambda Function with CDK ... - YouTube
In this video, I walk you through the steps to create an AWS Lambda function using CDK. I walk you through the process...
Read more >
Packaging - Serverless Framework
The Serverless Framework documentation for AWS Lambda, API Gateway, ... To enable individual packaging set individually to true in the service or function ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found