Function Naming Convention

Newish to the serverless framework.

When deploying a function serverless uses the following format serviceName-stage-functionName.

name: gitops

name: aws
runtime: nodejs10.x
region: us-west-2
profile: dev
versionFunctions: false

individually: true

handler: index.handler

memory: 512
timeout: 30

    - 'serverless.yml'

So in the case above the function name becomes gitops-dev-gitopsRepoInit.

Is there a way to customize what it names the function. I am not putting this behind API gateway so having the stage in the name (in this case dev) is useless and actually confuses people looking at it.

According to the serverless.yml reference there is a name parameter that can be used to name the deployed Lambda. Personally I would advise against it as the Serverless Framework stage isn’t the same as the API Gateway stage. Removing it will prevent you from deploying different stages to the same account later.

1 Like