Skip to content

sam-beta-cdk support for typescript lambda functions - aws-lambda-nodejs #3033

@gommich

Description

@gommich

The feature:
Would it be possible to add support for sam-cdk-beta to bundle typescript lambda functions using @aws-cdk/aws-lambda-nodejs (NodejsFunction) ?

What I've tried:
I have tried to use the @aws-cdk/aws-lambda-nodejs library to compile typescript functions as opposed to the @aws-cdk/aws-lambda library. However, what I notice is that when I run:

sam-beta-cdk build

the assets for a @aws-cdk/aws-lambda-nodejs (NodejsFunction) function only produce an index.js asset in the .aws-sam/cdk-out/asset.xxxxxxxxxxxxx/ directory but package.json also needs to be in there for the function to be build properly. If I manually add package.json from the function in question, then I can run

cdk deploy -a .aws-sam/build

and the stack will deploy correctly.

I'm not entirely sure if the solution would be as simple as adding package.json to the assets directory for a particular stack, but It seemed to work. Perhaps this is a feature I should request in the main aws-cdk repository. Please let me know if there's something I'm missing in my approach to creating typescript lambda functions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions