Hi! Just wanted to say thanks in advance for this ...
# help
o
Hi! Just wanted to say thanks in advance for this awesome project, it's been so helpful in getting familiar with AWS and IaC :) I'm creating a basic typescript project with 4 stacks: • secret manager • dynamo db • apollo api • cron (w/ a Python Lambda) When I run
yarn sst start
, I notice that the Python Lambda function is created with the incorrect runtime environment (node JS). Additionally, both the Python Lambda and the Apollo lambda are not copying the files from
src
correctly. My directory structure is shown in the attached photo, and here is the code that I've used to create my cron and apollo stacks. Anyone seen this before? Thanks!
Copy code
// CronStack.ts
    const lambda = new Function(this, "Lambda", {
      srcPath: "src/cron",
      handler: "index.handler",
      runtime: "python3.8",
      environment: {
        TABLE_NAME: table.tableName,
        NYTX: apikey.secretValue.toString(),
      },
    });

    new Cron(this, "Cron", {
      schedule: "cron(55 2 * * ? *)",
      job: lambda,
    });
Copy code
// ApolloStack.ts
    const api = new ApolloApi(this, "ApolloApi", {
      defaultFunctionProps: {
        environment: {
          TABLE_NAME: table.tableName,
        },
      },
      server: "src/apollo/index.handler",
    });
I guess this happened because i was running
yarn sst start
instead of
yarn sst deploy
o
Yeah - when you do sst start, it deploys a stub node.js runtime into AWS that proxies requests back to you. For the srcPath, did you fix that already?
t
For python we simply copy everything in
srcPath
and load it into your lambda - can you expand on what isn't working?
o
Thanks for the quick responses! Yeah, I was confused because the EventBridge layers created by the
CronStack
were calling the
node.js
stub when I was expecting it to call the Python bundle.
srcPath
was set correctly, I just needed to call
sst deploy
and it is working as expected