sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.11k stars 131 forks source link

Inconsistent provisioned concurrency and publish: true #375

Closed schwjustin closed 3 weeks ago

schwjustin commented 2 months ago

I was able to get provisioned concurrency working for my lambda using aws.lambda.ProvisionedConcurrencyConfig, however, it seems to work inconsistently. If I comment out the config and then deploy, it successfully removes the provisioned concurrency for this lambda. Then, if I uncomment it and deploy again, sometimes I get FUNCTION_ERROR_INIT_FAILURE. Also, it seems like when I update my lambda handler, I don't always get a new version published when I deploy. For example, I added a console log at the top of my handler, deployed, and under versions my lambda still had version 3 from 2 hours ago after refreshing my AWS console.

const testRoute = api.route("GET /test", {
    handler: "services/test/handler",
    transform: {
        function: (args) => {
            args.publish = true;
        },
    },
    link: [...keys],
});

const osintURLConcurrency = new aws.lambda.ProvisionedConcurrencyConfig("ProvisionedConcurrencyName", {
    functionName: testRoute.function.name.apply((name) => name),
    qualifier: testRoute.function.nodes.function.version.apply((version) => version),
    provisionedConcurrentExecutions: 1,
});
ProvisionedConcurrencyName aws:lambda:ProvisionedConcurrencyConfig
   creating urn:pulumi:justinschwartz::sst::aws:lambda/provisionedConcurrencyConfig:ProvisionedConcurrencyConfig::ProvisionedConcurrencyName: 1 error occurred:

   waiting for Lambda Provisioned Concurrency Config (sst-justinschwartz-APIRoute____HandlerFunction,1) to be ready: status reason: FUNCTION_ERROR_INIT_FAILURE
schwjustin commented 2 months ago

This was using sst version 0.0.343

schwjustin commented 3 weeks ago

To reliably use provisioned concurrency you have to add a description to the lambda that changes on every deploy:

transform: {
    function: (args) => {
        args.publish = true;
        args.description = "Deployed at " + new Date().toISOString(); // add this
    },
},
jayair commented 1 week ago

Huh that's so weird lol