[Resolved] Deploy Fails with CREATE_FAILED on AWS::ApiGateway::Resource

I’m attempting to deploy my api for the first time, but get an error in the process that stops the stack update and causes a rollback.

The relevant part of the log output is:

...
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::RestApi - ApiGatewayRestApi
CloudFormation - CREATE_FAILED - AWS::ApiGateway::Resource - ApiGatewayResourceApi
CloudFormation - CREATE_FAILED - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - usersTable
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - resortsTable
CloudFormation - UPDATE_ROLLBACK_IN_PROGRESS - AWS::CloudFormation::Stack - ullerApi-dev
...

It seems like the relevant portion of the CFT is:

"ApiGatewayResourceApi": {
      "Type": "AWS::ApiGateway::Resource",
      "Properties": {
        "ParentId": {
          "Fn::GetAtt": [
            "ApiGatewayRestApi",
            "RootResourceId"
          ],
          "Ref": "ApiGatewayResource"
        },
        "PathPart": "api",
        "RestApiId": {
          "Ref": "ApiGatewayRestApi"
        }
      }
    },

Any ideas on what might be causing this or how to resolve it?

Found the problem!

In my serverless.yml file, when defining the http events that would trigger my function, I accidentally had a leading “/” on several of the paths. Ex “path: /api/v0/register” when it should have been “path: api/v0/register”

Removing the leading slash solved the issue.

1 Like