This message was deleted.
# getting-started
s
This message was deleted.
w
I don't know much about Pulumi but are you adding the devDependencies to your dependencies in the package.json as this is just a lambda limit.
m
@thankful-ambulance-76337 I believe nodejs18+ uses the AWS SDK v3 by default, so assuming the following folder structure (attached)
Copy code
index.ts
lambda/s3-retrieval.js
lambda/package.json
you'd use:
Copy code
code: new pulumi.asset.FileArchive("./lambda"),
    runtime: aws.lambda.Runtime.NodeJS20dX,
    handler: 's3-retrieval.handler',
    tracingConfig: {
        mode: "Active",
    },
    memorySize: 256,
    timeout: 10,
    role: lambdaRole.arn,
    environment: {
        variables: {
            BUCKET_NAME: assetsBucket.bucket,
        },
    },
A few things: a) There is no need to use AssetArchive - FileArchive zips the entire folder it points to. b) Within that folder, the handler is [fileName].[methodName] So above: /lambda/s3-retrieval.js : handler is what gets invoked. If the entire folders' size (including node_modules) is too large, you'd see that message. You can reduce your node_modules size (assuming this is indeed the issue and you haven't ran into a legitimate bug) by using AWS SDKv3 - specific imports, as such:
Copy code
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
import { gzipSync } from "zlib";
the SDK v3 imports and usage are very different from the SDK v2. This has caused me a lot of grief before.
In package.json (this is more of a Lambda than a Pulumi thing), you usually either want:
Copy code
{
  "private": "true",
  "type": "module"
}
or an mjs extension in the file containing the handler.