hundreds-airport-72212
05/09/2024, 7:31 AMhandler/*
that houses all my lambda functions which all export handler export const handler = () => {}
Here's an examples creating a lambda:
const formatterLambda = new aws.lambda.Function(
"payout-line-transformer",
{
name: "payout-line-transformer",
runtime: aws.lambda.Runtime.NodeJS18dX,
handler: "payout-line-transformer.handler",
code: new pulumi.asset.AssetArchive({
".": new pulumi.asset.FileArchive(
"./bin/handlers/payout-line-transformer.js",
),
}),
role: iamForLambda.arn,
},
{ dependsOn: [iamForLambda] },
);
This fails to create with error Error: failed to register new resource payout-line-transformer [aws:lambda/function:Function]: 2 UNKNOWN: failed to compute archive hash for ".": './bin/handlers/payout-line-transformer.js' is neither a recognized archive type nor a directory
I understand that error, the problem is where I change the code
to the below, all the files inside the handlers folder are packaged inside all the lambda
code: new pulumi.asset.AssetArchive({
".": new pulumi.asset.FileArchive(
"./bin/handlers",
),
I end up with something that looks like the attached screenshot, which is not what I want. I have not tried creating a .zip of a lambda, this is a bit strange to me coming from SST.
My last question, is the package I install do not seem to be included in the lambda, somehow the "node_modules get left out". Everything works nicely in Pulumi except this lambda creating for me has been a bit weird.
Any help will be appreciated 🙏
Thanks for the help.dry-keyboard-94795
05/09/2024, 9:16 AMFileAsset
, not FileArchive
dry-keyboard-94795
05/09/2024, 9:18 AMhundreds-airport-72212
05/09/2024, 9:38 AMdry-keyboard-94795
05/09/2024, 9:39 AMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by