How do I set different timeouts for different stac...
# help
l
How do I set different timeouts for different stacks? I have two stacks - Api and Edge. I want Edge to have a different timeout to Api. I've looked through the documentation, not sure how to achieve this (I can find a way to set timeout at the function level but not at the stack level). Apologies for the basic question - possible that the answer is very obvious! Attached picture of index.js
t
I don't think there's a way to do this right now but if using the sst.API construct you can specify default function props there as well
l
Ah OK - little bit confused about what that would entail
shows how you can set the timeout for all the functions in an API
f
Hey @Louis Barclay Can I see what your
Edge
stack roughly look like? I think we can add a
setDefaultFunctionProps
on the
Stack
object.
Feel free to DM me if that works better.
l
Thanks so much both! Looks like it's doable!
Copy code
import * as sst from "@serverless-stack/resources";

export default class Edge extends sst.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    // Create a HTTP API
    const api = new sst.Api(this, "Api", {
      defaultFunctionProps: {
        timeout: 20,
      },
      routes: {
        "POST /create": "src/edge/create.main",
      },
    });

    // Show the endpoint in the output
    this.addOutputs({
      ApiEndpoint: api.url,
    });
  }
}
Snippet ^