tmokmss / cdk-lambda-llrt

Deploy LLRT Lambda functions w/ CDK
https://constructs.dev/packages/cdk-lambda-llrt/
Apache License 2.0
41 stars 2 forks source link

Add Support for Code instead of forcing bundling of the code. #7

Open asheliahut opened 1 month ago

asheliahut commented 1 month ago

I have some example code below that uses NodejsFunction today and I would like to be able to use this for LLRT, but I am bundling things myself using Bun. I would like a way to do this and then have it bundle the llrt with my pre bundled code.

const fn = new NodejsFunction(this, 'Lambda', {
    entry: 'index.mjs',
    handler: 'index.handler',
    code: Code.fromAsset('dist'),
    runtime: Runtime.NODEJS_20_X,
});

So the end result would look like this below and it would still be able to use llrt:

const fn = new LlrtFunction(this, 'Lambda', {
    entry: 'index.mjs',
    handler: 'index.handler',
    code: Code.fromAsset('dist'),
});
tmokmss commented 1 month ago

This is actually difficult to achieve, because we cannot inject code to download LLRT binary to the Code instance. I'll research for available ways to do that.