Hi all, I need some help setting up my lambda wit...
# getting-started
Hi all, I need some help setting up my lambda with Pulumi, nothing seems to work as expected from the docs. We're trying to migrate off SST I have a folder
that houses all my lambda functions which all export handler
export const handler = () => {}
Here's an examples creating a lambda:
Copy code
const formatterLambda = new aws.lambda.Function(
      name: "payout-line-transformer",
      runtime: aws.lambda.Runtime.NodeJS18dX,
      handler: "payout-line-transformer.handler",
      code: new pulumi.asset.AssetArchive({
        ".": new pulumi.asset.FileArchive(
      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
to the below, all the files inside the handlers folder are packaged inside all the lambda
Copy code
code: new pulumi.asset.AssetArchive({
        ".": new pulumi.asset.FileArchive(
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.
For a single file, you'd need to use
, not
What version of the pulumi cli do you have installed? There was recently a regression around asset lookups, so can you make sure you're on the latest version
Thanks for the quick response, I'll give that a try. I'm using v3.112.0
3.112 should be fine