Search code examples
node.jsswagger-2.0

Swagger v2 405 error Error: No implementation found for this path


I figured it out! Felt really stupid now.

I forgot to add this:

x-swagger-router-controller: webhook

just before the post: tag

I keep the original details below with the fix:

I am testing webhooks from payment sandbox but I keep getting 405 error: No Implementation found for this path. Tried looking for a solution here but haven't find anything.

I am using ngrok to expose my local dev to the payment sandbox site where I can test my endpoint url

the path set (my URL endpoint) in the sandbox is http s://82d69e226afb.ngrok.io/v1/paymentwebhook/success (I intentionally added a space after s from http to not create a link)

Here is the swagger route for the path:

  /paymentwebhook/success:
    x-swagger-router-controller: webhook --> **fix**
    post:
      tags:
        - webhook
      summary: Webhook endpoint for success
      operationId: HandleSuccess
      # consumes:
      #   - application/json
      parameters:
        - name: body
          in: body
          description: post contents
          required: true
          schema:
            type: object
            properties:
              id:
                type: string
              amount:
                type: number
              currency:
                type: string
              status:
                type: string
              requestReferenceNumber:
                type: string
      responses:
        200:
          description: Successful payment.
          # schema:
          #   $ref: "#/definitions/PostOperationSuccess"
        401:
          $ref: "#/responses/ErrorResponse401Auth"
        500:
          $ref: "#/responses/ErrorResponse500Server"
    
   

Solution

  • I forgot to add the x-swagger-router-controller tag. This fixes the problem