Open Source API Gateway

404 Not Found: No Matching API Found

Membrane API Gateway returns 404 Not Found with the title No matching API found! when a request reaches an API deployed from OpenAPI documents, but its path does not start with the base path of any of these documents.

The Error Response

The response contains the status 404 Not Found, the title No matching API found!, the detail There is no API on the path /products deployed. Please check the path. with the requested path, the problem type https://membrane-api.io/problems/user and a link to this page. The type user means that the request or the configuration caused the problem, not an internal failure of the gateway.

How Membrane Finds the OpenAPI Document

An api with openapi entries can serve several OpenAPI documents. Each document is published under a base path, which Membrane takes from the path part of the servers URLs in the document, or from rewrite: basePath in the configuration. For a document with the server URL https://api.example.com/fruitshop/v2, the base path is /fruitshop/v2, and a request to /fruitshop/v2/products is validated against that document.

The OpenAPI validator selects the document whose base path the request path starts with. If there is none, it answers with this error. If no API matches the request at all, Membrane answers with 404 Invalid Path or Method instead.

Common Causes

The Path Does Not Start with a Base Path

The client calls /shop/products, but the server URL of the document is https://api.example.com/fruitshop/v2. Check the request for a missing or outdated prefix, such as an old version number.

A Plugin Changed the Path

If a plugin placed before the OpenAPI validator in the flow changes the request path, for example a rewriter, the path may no longer start with a base path by the time it is validated.

The openapiPublisher Is Placed After the Validator

Membrane adds openapiPublisher and openapiValidator at the top of the flow automatically. If you place openapiPublisher manually after openapiValidator, requests for /api-docs may reach the validator first and fail with this error.

How to Fix It

  1. Open /api-docs on the gateway to see the deployed documents and their paths.
  2. Compare the request path with the base paths of the documents and correct the request.
  3. As an operator, check the servers URLs of the OpenAPI documents, or publish the API under a different path with rewrite:
api:
port: 2000
openapi:
- location: fruitshop-api.yml
rewrite:
basePath: /shop
api:
  port: 2000
  openapi:
    - location: fruitshop-api.yml
      rewrite:
        basePath: /shop

Put plugins that change the path after the OpenAPI validator, and put openapiPublisher before it, or leave both out so that Membrane places them. See Rewrite OpenAPI for more on rewriting.

Details in Production Mode

Unlike most errors, this response is not shortened in production mode. It contains the detail and the link to this page even with production: true. The detail only repeats the path of the request, so it does not reveal information about your setup.

Related Documentation

Configuration reference:

Tutorials with runnable examples:

← All Membrane error messages

Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.