When I work with custom UI of my APS 2 application, I see requests failing with error 500.

When I check apache error log on endpoint server, I see error that look like this:

ERROR Exception: code=500,
type=Rest\RestException, message=Failed to parse aps object: Request to
APS controller failed: APS::Util::Exception: Unauthorized request#0


Endpoint cannot authenticate to APS controller


Most likely cause is lost or incorrect application certificate stored on the endpoint server. Endpoint uses these certificates to authenticate its requests to APS controller. If the certificate is lost, the endpoint has no way of proving its identity to the controller.

With PHP runtime library, the certificates are stored in config subfolder of your endpoint folder. They are stored in two files:

  1. [application_instance_id]
  2. [application_instance_id].pem

, where application_instance_id is the ID of an APS application instance (in UID format, you can find it in APS-Instance-ID header of outgoing request from Operations Automation to your endpoint, more information on headers available here).

If these files are missing, the application certificate is lost. There is no mechanism to recover it, you should either retrieve the files from backup or destroy an application instance and create a new one which will get a new certificate.

If only .pem file is missing, you can recover the certificate from the remaining file (the one without extension), this is a config in JSON format and application certificate is stored in appCertificate property. You can retrieve the value, replace \n with newline characters and save the result into a file with .pem extension.

For development or testing environments recreating an application instance will be a faster solution in most cases.

Internal content