Amplify-cli: Amplify allows non alphanumeric lambda function name and then fails on amplify push

Created on 4 Dec 2020  Â·  3Comments  Â·  Source: aws-amplify/amplify-cli

I used amplify add api to create an api for my project
I use amplify add api

I wanted to create a RESTful api
During this process I created a new Lambda function
There was no warning when I named a lambda function using a non alphanumeric name

When I try to use amplify push I get the following error:

Template format error: Resource name functionfind-buddies is non alphanumeric.
An error occurred during the push operation: Template format error: Resource name functionfind-buddies is non alphanumeric.

When I try to use amplify remove api and remove my api resource and try amplify push again I get the same error.

How can I delete the api and start over ?
This is a bug as I should get a warning if I use a non alpha numeric name for a Lambda function.

bug functions

Most helpful comment

I think there was an error before when adding function with non alphanumeric lambda function name as the pic shows. I confirmed this with @aws-amplify/[email protected].

image

I suggest validating function name in adding function because you need to remove and add function again after adding function now and this is very difficult process to think of for Amplify beginners.

All 3 comments

@donnrri it looks like this is a bug on the CLI side for now you would have to remove the function and replace it without a hyphen

Took me a long time to figure this out. I added an amplify function, where the name had dashes.
On running amplify push, I got the following output: "Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack" followed by some nice green messages about my graphql schema compiled successfully, and finally "√ All resources are updated in the cloud"
No error information at all. Cloudformation didn't show any error. My function just didn't appear anywhere.
The only way I figured it out was by trial and error multiple times, until I realized the functions without dashes in their names worked fine.

I think there was an error before when adding function with non alphanumeric lambda function name as the pic shows. I confirmed this with @aws-amplify/[email protected].

image

I suggest validating function name in adding function because you need to remove and add function again after adding function now and this is very difficult process to think of for Amplify beginners.

Was this page helpful?
0 / 5 - 0 ratings