Is there a way to use a different way to name the ...
# help
j
Is there a way to use a different way to name the functions generated from the APIs? It just gets a little bit hard to find them when trying to debug or just find their Cloudwatch logs. These are two different endpoints that are creating an almost identical function names
Copy code
GET /modules/{moduleId}
GET /modules/{moduleId}/shuttles
f
Hi Justin, you can override the function name:
Copy code
sst.Api(this, "MyApi", {
  routes: {
    "GET /modules/{moduleId}": {
      handler: "src/lambda.main",
      functionName: "get-modules",
    }
  }
});
You’d have to override the
functionName
for each route.
^here’s a discussion around auto-generating friendly function names https://github.com/serverless-stack/serverless-stack/discussions/236
j
Ah cool. Didn't realize that it extended the normal CDK function props