limited-fish-67957
04/08/2022, 4:32 PMpulumi
is the my node_modules are not getting uploaded to aws lambda
. I was wondering if anyone has solved this or point me to some kind of solution of uploading the node-modules
as my serverless
function keeps giving me module not found error
great-queen-39697
04/08/2022, 4:34 PMlimited-fish-67957
04/08/2022, 4:43 PMimport * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
import { main } from "../src/index";
const config = new pulumi.Config();
const lambdaRole = new aws.iam.Role("lambdaRole", {
assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({
Service: "<http://lambda.amazonaws.com|lambda.amazonaws.com>",
}),
});
const lambdaRolePolicy = "the policy"
const someService = new aws.lambda.CallbackFunction("service-name", {
runtime: "nodejs14.x",
role: lambdaRole,
callback: main
});
const someServiceSchedule: aws.cloudwatch.EventRuleEventSubscription = aws.cloudwatch.onSchedule(
"service-name",
"rate(30 minutes)",
someService,
);
great-queen-39697
04/08/2022, 5:27 PMcallback: main
part, but that's not code getting uploaded. See if these docs help: https://www.pulumi.com/registry/packages/aws/api-docs/lambda/function/#basic-examplelimited-fish-67957
04/08/2022, 5:39 PMfile archive
method to upload the function. Even after that, it says module not found
. Do I have to explicitly also add node_modules
for my lambda function to work?great-queen-39697
04/08/2022, 7:18 PMnode_modules
directory based on what I'm seeing in the AWS docs: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html#nodejs-package-dependencies