I'm using Lambda layers in a python project, and c...
# help
s
I'm using Lambda layers in a python project, and can confirm layers are being included correctly via the AWS console. However, I'm not sure I'm excluding the layers from my lambda functions correctly, since my lambdas are still fairly large (30+MB)
Copy code
export default function main(app: <http://sst.App|sst.App>): void {
  const requestsLayer  = (stack) =>  LayerVersion.fromLayerVersionArn(stack, "requestsLayer", requestsLayerArn);
  const psycopgLayer  = (stack) =>  LayerVersion.fromLayerVersionArn(stack, "psycopgLayer", psycopgLayerArn);

  app.setDefaultFunctionProps((stack) => {
    // other config omitted
    const props = {
      runtime: "python3.8",
      srcPath: "src",
      logRetention: config.logRetention,
      layers: app.local ? [] :[requestsLayer(stack),psycopgLayer(stack)], // <--- this is working
      vpc: vpc,
      subnets: vpc.publicSubnets,
      securityGroups: [securityGroup],
      bundle:{
        externalModules: app.local ? [] : [requestsLayer,psycopgLayer] // <--- should this work ??
    }
    return props;
  }
}
t
This only works for node! Our typing system unfortunately doesn't help you with this since we don't know what runtime the function is for
Python bundling basically doesn't exist afaik so we can't do that for you
s
Yeah, I was hoping that wasn't the case 😢