Open Source API Gateway

500 Internal Server Error: Error Serving Document

Membrane API Gateway returns 500 Internal Server Error with the detail Error serving document when the webServer plugin hits an I/O error while it serves a document in the request flow. The same applies to components built on it: adminConsole and the login dialogs of login and oauth2authserver.

The Error Response

The response contains the status 500 Internal Server Error, the detail Error serving document, the problem type https://membrane-api.io/problems/internal and a link to this page. The type internal means that the gateway could not complete the processing of the message. In production mode, the title is replaced by Internal Server Error and the details are left out.

What the Web Server Does

The webServer plugin serves static files from a directory, and can generate a directory index. A missing file does not lead to this error: it gets a 404 Not Found.

Common Causes

An Unexpected I/O Error

In the current version of Membrane, none of the built-in file resolvers produces the kind of I/O error that leads to this response. This error is therefore very rare. If it occurs, it points to an unexpected internal state, for example while listing a directory for a generated index (generateIndex: true), and usually indicates a bug in Membrane.

How to Fix It

  1. Enable development mode to see the details, or check the gateway log. In production, use the log key of the response to find the entry.
  2. Report the problem with the stack trace and the request that triggered it on GitHub Issues.

Hide Details in Production

By default, Membrane runs in development mode and adds details to error responses that help you find the problem. These details may reveal information about your setup. In production, turn them off:

configuration:
production: true
configuration:
  production: true

Add the configuration document to your apis.yaml and separate it from the APIs with ---. The title then reads Internal Server Error, and the details and the link to this page are left out. If the response contains a log key, search the gateway log for it to find the full error message.

Related Documentation

Configuration reference:

← All Membrane error messages

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