An error occurred: SubmitDashmoduleLogGroup - /aws/lambda/DEV-get-course already exists in stack

When I try to deploy my application, I get the following error:
An error occurred: SubmitDashmoduleLogGroup - /aws/lambda/DEV-get-course already exists in stack

I tried the following…

  1. Deleted the entire stack
  2. aws logs delete-log-group --log-group-name SubmitDashmoduleLogGroup
  3. The delete command gives me: An error occurred (ResourceNotFoundException) when calling the DeleteLogGroup operation: The specified log group does not exist.
  4. I double check the AWS console and no CloudWatch logs exist
  5. Rerun serverless deploy
  6. I still get the above error. What’s happening?

As a side note, every other resource defined in my serverless.yml is created successfully in the stack, except for the log groups (I also get this error a couple times).

Thanks in advance.

I figured out the problem. As often as it occurs, it was a simple, annoying, frustrating, typo. Hopefully, this will at least help someone else uncover the source of the problem.

In my serverless.yml, I had three functions defined. While trying to solve a different problem, I renamed my functions like so: {stage}-{functionName}. However, after renaming the first one, I just copied and pasted to the second and third, then updated the function name, but I never updated the second function name. So, the first function’s logs conflicted with the second.

Basically, I had this:
{stage}-{functionA}
{stage}-{functionA}
{stage}-{functionC}

But should have had this,
{stage}-{functionA}
{stage}-{functionB}
{stage}-{functionC}

Once I made this change, my stack was created successfully without error.