You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Serverless deployment with the plugin fails when the serverless application name is non-alphanumeric. For example, the below serverless.yaml would not successfully deploy when the plugin is configured
service: example-service
plugins:
- serverless-fargate-plugin
custom:
fargate:
clusterName: Test
It will fail with error
Error: The CloudFormation template is invalid: Template format error: Resource name example-serviceTestClust is non alphanumeric.
This is likely happening because the plugin is concatenating the raw service name with the clusterName property to form the namePrefix as linked below and serverless is attempting to use that namePrefix as the Resource name for the Cloudformation (CF) stack.
CF however, requires alphanumeric names for Resource Names.
Raising this as an issue as non-alphanumeric service names above are valid in serverless.yaml files, and shouldn't be used to prefix strings that may be used as Resource Names in CF.
A couple of ways I can think of addressing this are:
a) Auto substituting non-alphanumeric values in the namePrefix to make it alphanumeric before use (this could break existing deployments using the plugin)
b) Introducing a usePrefix flag that defaults to true but can be set to false if a user doesn't want clusterName prefixed
If either of those options sounds appealing or you have alternative options you'd like to explore, please let me know and I'd be happy to take a swing at creating a PR for the fix
The text was updated successfully, but these errors were encountered:
Serverless deployment with the plugin fails when the serverless application name is non-alphanumeric. For example, the below serverless.yaml would not successfully deploy when the plugin is configured
It will fail with error
This is likely happening because the plugin is concatenating the raw service name with the
clusterName
property to form thenamePrefix
as linked below and serverless is attempting to use thatnamePrefix
as the Resource name for the Cloudformation (CF) stack.serverless-fargate-plugin/src/resources/cluster.ts
Line 15 in e2bbdb3
CF however, requires alphanumeric names for Resource Names.
Raising this as an issue as non-alphanumeric service names above are valid in serverless.yaml files, and shouldn't be used to prefix strings that may be used as Resource Names in CF.
A couple of ways I can think of addressing this are:
a) Auto substituting non-alphanumeric values in the
namePrefix
to make it alphanumeric before use (this could break existing deployments using the plugin)b) Introducing a
usePrefix
flag that defaults to true but can be set to false if a user doesn't want clusterName prefixedIf either of those options sounds appealing or you have alternative options you'd like to explore, please let me know and I'd be happy to take a swing at creating a PR for the fix
The text was updated successfully, but these errors were encountered: