Membrane API Gateway returns 500 Internal Server Error with the detail Error handling response! when the OAuth2 client plugin oauth2Resource2 cannot store its session in the response.
The response contains the status 500 Internal Server Error, the detail Error handling response!, 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.
The oauth2Resource2 plugin keeps the login in a session. It does nothing else in the response flow: there, the session manager stores the session and sets the session cookie with a Set-Cookie header. This error means that this step failed, so the cause is the session configuration or its environment.
The log reads The newly created session could not be persisted in the Set-Cookie header. A remote session store such as Redis or Memcached is unreachable or rejected the write.
The cookie value could not be created, for example because a JWT-based session manager could not sign the session.
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 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.
Configuration reference:
Tutorials with runnable examples:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.