https://serverless-stack.com/ logo
#help
Title
# help
k

Klaus

05/20/2022, 9:41 PM
@thdxr @Frank As a SST newbie, I had a look at a few examples and saw lambda functions were all configured together with API e.g.
Copy code
import { StackContext, Api } from "@serverless-stack/resources";

export function MyStack({ stack }: StackContext) {
  new Api(stack, "api", {
    routes: {
      "GET /": "functions/lambda.handler",
    },
  });
}
This made me wonder, if
Lamdba life-debugging
would also work without any API gateway involved.
E.g. We have use cases where the function just reads data from S3, interacts with databases, SQS / SNS, but is never exposed externally via an API Gateway URL at all. As a result, the execution limit is 15 mins instead of just the 30 seconds API gateway allows. Because SST doesn't seem to have a function
invoke
similar to the Serverless framework, I was wondering if Function-Urls could perhaps be used as an alternative approach in testing + then later removed for production deployment
r

Ross Coundon

05/20/2022, 9:53 PM
Functions that are triggered from events from the likes of SNS, sqs, streams etc can be live debugged. You can also call functions using the console. Alternatively you could use jest or vitest or similar to call a function in an integration test
k

Klaus

05/20/2022, 10:12 PM
Great - I just saw the invoke option in the console, which should be fine. Now I just have to get Python debugging to work 😉
I've now replaced the API gateway with a function URL that's just used for debugging. This results in a longer timeout setting and seems to work as expected with curl. When using the URL in the browser, there is an extra request for '/favicon.ico' which could be filtered by the processing function.
f

Frank

05/25/2022, 6:16 AM
@Klaus as a side note, you can use the
--increase-timeout
option with
sst start
to have function timeout extended to 900s.
3 Views