Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apigatewaymanagementapi :GetConnection returns “No method found matching route @connections/ for http method GET” #201

Open
hadils opened this issue Dec 13, 2021 · 0 comments

Comments

@hadils
Copy link

hadils commented Dec 13, 2021

Dependencies

             com.cognitect.aws/api                         {:mvn/version "0.8.536"}
             com.cognitect.aws/endpoints                   {:mvn/version "1.1.12.110"}
             com.cognitect.aws/ssm                         {:mvn/version "814.2.1028.0"}
             com.cognitect.aws/sns                         {:mvn/version "811.2.959.0"}
             com.cognitect.aws/cognito-idp                 {:mvn/version "811.2.958.0"}
             com.cognitect.aws/location                    {:mvn/version "814.2.1008.0", :aws/serviceFullName "Amazon Location Service"},
             com.cognitect.aws/s3                          {:mvn/version "814.2.991.0"}
             com.cognitect.aws/apigatewayv2                {:mvn/version "813.2.972.0"}
             com.cognitect.aws/apigatewaymanagementapi     {:mvn/version "770.2.568.0"}

             org.clojure/clojure                           {:mvn/version "1.10.3"}

Description with failing test case

I have defined

(def apipost (aws/client
               {:api                  :apigatewaymanagementapi
                :region               "us-west-2"
                :endpoint-override    {:hostname host
                                       :path     (str "/" stage "/@connections/")}}))

Important: Please include a complete minimal code example that we
can paste as/is into a REPL, execute, and watch fail.

I am using AWS Lambda functions to connect to a Websocket API. Here is the text from the AWS Technical support case:

I did some research and to replicate the issue I followed the below steps:

  1. I created a WebSocket API and integrated a Lambda Function with the ‘$connect’ method, which printed the connectionId. I obtained connectionId from CloudWatch logs.

  2. Then I started a connection using wscat utility as below :
    $ wscat -c wss://someapi.execute-api.ap-south-1.amazonaws.com/production
    Connected (press CTRL+C to quit)

  3. Made a GET request to the the connection URL to get the status of the connectionId. I used ‘awscurl’ utility to test this as below:
    $ awscurl --service execute-api -X GET https://someapi.execute-api.ap-south-1.amazonaws.com/production/@connections/KSIqme0vBcwCG-g=
    I got response in below format for this request:
    {
    {
    "identity" : {
    "sourceIp" : "X.X.X.X",
    "userAgent" : null
    },
    "connectedAt" : "2021-12-13T10:33:26.844Z",
    "lastActiveAt" : "2021-12-13T10:33:26.844Z"
    }

  4. However, when I removed the ‘connectionId’ from the end of URL used above and made the request
    $ awscurl --service execute-api -X GET https://someapi.execute-api.ap-south-1.amazonaws.com/production/@connections/
    I received same error as yours i.e.
    {"message":"No method found matching route @connections/ for http method GET."}

To summarize, the URL needs to have connectionId at the end in order to check status of that specific connectionId using GET request.

The :GetConnection invocation is:

(aws/invoke apipost {:op      :GetConnection
                                             :request {:ConnectionId connection-id}})

where. connection-id is a valid ConnectionId taken from the Lambda input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant