sst / ion

SST v3
https://sst.dev
MIT License
1.97k stars 229 forks source link

Lambda function provisioned concurrency #308

Closed schwjustin closed 5 months ago

schwjustin commented 5 months ago

When I deploy I see the provisioned concurrency config with in progress status for this lambda in my aws console, so I know something is happening, but then after loading for a while the status changes to FUNCTION_ERROR_INIT_FAILURE. I tried deploying and hitting this route without the provisioned concurrency config so I know the handler works.

Can provisioned concurrency be added as an option for sst ion functions so configuring it through the aws provider wouldn't be necessary?

export default $config({
    app(input) {
        return {
            name: "sst",
            removal: input?.stage === "production" ? "retain" : "remove",
            home: "aws",
        };
    },
    async run() {
      const api = new sst.aws.ApiGatewayV2("API");

      const test = api.route("GET /test", {
          handler: "index.handler",
          transform: {
              function: (args) => ({
                  ...args,
                  publish: true,
              }),
          },

      });

      const fixed = new aws.lambda.ProvisionedConcurrencyConfig("FixedConcurrency", {
          functionName: test.function.name,
          qualifier: test.function.nodes.function.version,
          provisionedConcurrentExecutions: 2,
      });
    },
});
schwjustin commented 5 months ago

The problem was not using .apply() on .name and .version, it works now!

jayair commented 5 months ago

Did you not get type errors on that?