Membrane API Gateway returns 500 Internal Server Error with the detail Could not parse query parameters! when the formValidation plugin cannot extract the parameters of a request. Membrane reports this as a 500, but the cause is usually the client's request.
The response contains the status 500 Internal Server Error, the detail Could not parse query parameters!, the offending request URI in the uri field, 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 request. In production mode, the title is replaced by Internal Server Error and the details are left out.
The formValidation plugin checks the parameters of the query string or of an application/x-www-form-urlencoded body against regular expressions, one per field. Before it can check them, it has to parse them. If parsing fails, this error is returned instead of a validation result.
The plugin parses parameters strictly and rejects duplicates, e.g. ?age=1&age=2. The underlying message reads Could not parse query: ....
A parameter contains an invalid percent-escape, e.g. %zz or a trailing %.
The request URI contains characters that Membrane's URI parser does not accept.
The body could not be read or decoded, for example because the client closed the connection during the upload or sent an unsupported Content-Encoding.
Any other exception thrown by the plugin is reported under the same URL by Membrane's generic error handler. The detail then reads Aborting! Exception caused in … flow. and names the plugin, the request URI and the flow. Unless the exception points to your configuration or to the request, this usually indicates a bug in Membrane.
Content-Encoding the gateway supports.uri field of the response. Enable development mode, or use the log key in production, to see the underlying exception.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: trueconfiguration: production: true
Add the configuration document to your apis.yaml and separate it from the APIs with ---. The response then only contains a log key. Search the gateway log for this key to find the exception.
If the plugin is nested inside a request, response or abort element, the exception message, the stack trace and the link to this page are currently sent even in production mode. Fix the failing plugin rather than relying on production mode to hide them.
Configuration reference:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.