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

Iamgingertrash

02/07/2022, 4:17 AM
Is it possible to use my own custom naming scheme for Lambda functions deployed using SST?
The names of my functions are long, and they get truncated when using SST to deploy which means that often times, my functions look similar in their lambda names and I have to look carefully to find the right function
t

thdxr

02/07/2022, 4:30 AM
You can override the automatic name and we provide a callback as well. But I haven't cared about it as much with the new console - have you tried it?
Console shows functions by ID
j

Jay

02/14/2022, 8:44 PM
Just leaving a note here for @Frank, we should document this better.
i

Iamgingertrash

02/14/2022, 8:45 PM
Can you lead me to the docs or anything explaining this better? Really getting hard to track now with the weird naming
f

Frank

02/14/2022, 8:48 PM
Hey @Iamgingertrash you can specify the function names like this:
Copy code
new Function(this, "MyFunction", {
  functionName: app.logicalPrefixName("my-function"),
  handler: "src/lambda.main",
});
by using
app.logicalPrefixName
it prefixes the function name with stage name and the app name. You can read more about it here https://docs.serverless-stack.com/constructs/App#logicalprefixedname
i

Iamgingertrash

02/14/2022, 9:00 PM
Ty, where does this snippet belong? In the app file? Or stack?
t

thdxr

02/14/2022, 9:04 PM
What format are you trying to have for your function name?
this example you'd have to do it function by function
i

Iamgingertrash

02/14/2022, 9:04 PM
Trying to just use the handler name as the function name
t

thdxr

02/14/2022, 9:04 PM
Curious what you're looking in the aws console for?
i

Iamgingertrash

02/14/2022, 9:04 PM
For eg one of our endpoints is /propagate_polygon_snark_transaction
And we have others with the same “propagate” in it
And always have to guess which is which
Cause it's truncated in the aws console
t

thdxr

02/14/2022, 9:06 PM
If this is with the api construct you'll need to do it per function eg
Copy code
"GET /thing": {
  handler: "./myfunc",
  functionName: app.logicalPrefixName("my-function"),
}