# Can't add Proxy with ApiGateway to my Lambda Function

**URL:** <https://forum.serverless.com/t/cant-add-proxy-with-apigateway-to-my-lambda-function/17496>\
**Category:** Serverless Framework\
**Tags:** api-gateway\
**Created:** [August 10, 2022, 9:39am UTC](https://forum.serverless.com/t/cant-add-proxy-with-apigateway-to-my-lambda-function/17496 "2022-08-10T09:39:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteoangrisano](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/matteoangrisano/32/6999_2.png) [@matteoangrisano](https://forum.serverless.com/u/matteoangrisano)\
**Post date:** [August 10, 2022, 9:39am UTC](https://forum.serverless.com/t/cant-add-proxy-with-apigateway-to-my-lambda-function/17496/1 "2022-08-10T09:39:24Z")

</div>

Hello,  
i’m trying to add proxy to my lambda function, but i’m getting error:  
“CREATE\_FAILED: ApiGatewayResourceJokes (AWS::ApiGateway::Resource)  
Resource handler returned message: “Another resource with the same parent already has this name: example (Service: ApiGateway, Status Code: 409, Request ID: 3fb2a85c-6fd2-4414-ad3f-72ee095da48b)” (RequestToken: f33a6da3-be94-9696-3fd6-35a7bc52ef0a, HandlerErrorCode: AlreadyExists)”

```auto
example:
    handler: lambdas/endpoints/proxy.handler
    events:
      - http: GET /example

```

```auto
ProxyResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Fn::GetAtt:
            - ApiGatewayRestApi # our default Rest API logical ID
            - RootResourceId
        PathPart: jokes # the endpoint in your API that is set as proxy
        RestApiId:
          Ref: ApiGatewayRestApi
    ProxyMethod:
      Type: AWS::ApiGateway::Method
      Properties:
        ResourceId:
          Ref: ProxyResource
        RestApiId:
          Ref: ApiGatewayRestApi
        HttpMethod: GET # the method of your proxy. Is it GET or POST or ... ?
        MethodResponses:
          - StatusCode: 200
        Integration:
          IntegrationHttpMethod: POST
          Type: HTTP
          Uri: http://api.icndb.com/jokes/random # the URL you want to set a proxy to
          IntegrationResponses:
            - StatusCode: 200

```
