ApiGateway custom domain path not found

Viewed 267

I've developed a new API that is supposed to be mapped to an existing Domain Name, however, when I try to reach it using POSTMAN I get the following error:

{ "statusCode": 404, "message": "Not found" },

I'm trying to reach it with the url https://removedforsecurity.net/personalize/events/firstTest/ where firstTest is my namespace.

I tested my function from the console to confirm that it is not a code error, it definitely has something to do with the mapping.

My cloudformation resources look like the following:

RestApi:
    Condition: DeployApiGatewayRest
    Type: AWS::Serverless::Api
    Properties:
      Description: REST API for personalization API endpoints
      StageName:
        Ref: EnvironmentParam
      CacheClusterEnabled: !If [DeployApiGatewayCache, true, false]
      CacheClusterSize: '1.6'
      DisableExecuteApiEndpoint: True
      MinimumCompressionSize: 2048
      Auth:
        ApiKeyRequired: !If [DeployApiKey, true, false]
        AddDefaultAuthorizerToCorsPreflight: false
        UsagePlan:
          CreateUsagePlan: PER_API
          Description: Usage plan for personalization REST APIs and API Key
      EndpointConfiguration:
        Type: EDGE
      MethodSettings:
        - ResourcePath: /recommend-items/{namespace}/{recommender}/{userId}
          HttpMethod: OPTIONS
          CachingEnabled: false
        - ResourcePath: /recommend-items/{namespace}/{recommender}/{userId}
          HttpMethod: GET
          CachingEnabled: true
          CacheTtlInSeconds: 10
        - ResourcePath: /related-items/{namespace}/{recommender}/{itemId}
          HttpMethod: OPTIONS
          CachingEnabled: false
        - ResourcePath: /related-items/{namespace}/{recommender}/{itemId}
          HttpMethod: GET
          CachingEnabled: true
          CacheTtlInSeconds: 30
        - ResourcePath: /rerank-items/{namespace}/{recommender}/{userId}/{itemIds}
          HttpMethod: OPTIONS
          CachingEnabled: false
        - ResourcePath: /rerank-items/{namespace}/{recommender}/{userId}/{itemIds}
          HttpMethod: GET
          CachingEnabled: true
          CacheTtlInSeconds: 10
        - ResourcePath: /rerank-items/{namespace}/{recommender}/{userId}
          HttpMethod: OPTIONS
          CachingEnabled: false
        - ResourcePath: /rerank-items/{namespace}/{recommender}/{userId}
          HttpMethod: POST
          CachingEnabled: false
        - ResourcePath: /events/{namespace}
          HttpMethod: OPTIONS
          CachingEnabled: false
        - ResourcePath: /events/{namespace}
          HttpMethod: POST
          CachingEnabled: false

  ApiKey:
    Condition: DeployApiKey
    Type: AWS::ApiGateway::ApiKey
    Properties:
      Description: REST API Key to use when making API calls to personalization APIs
      Enabled: true
      StageKeys:
      - RestApiId:
          Ref: RestApi
        StageName:
          Ref: RestApi.Stage

  ApiMapping:
    Type: AWS::ApiGateway::BasePathMapping
    Properties:
      BasePath: personalize
      DomainName: !Join ['-', [!Ref EnvironmentParam, removedforsecurity.net]]
      RestApiId: !Ref RestApi
      Stage: !Ref RestApi.Stage

I'm trying to reach it with the url https://removedforsecurity.net/personalize/events/firstTest/ where firstTest is my namespace.

Both the API and the Domain are Edge resources. In the ApiGateway console I can see that the mapping is created successfully, however, it won't work.

Also comment that with the original URL that ApiGateway provides it does work. Any help would be greatly appreciated.

0 Answers
Related