The document collects typical procedures helpful during application troubleshooting and debugging.
As mentioned in the Task Manager section, a scheduled APS process may contain initiating, provisioning/unprovisioning, and finalizing tasks.
When a process over a resource is started, the APS controller changes the resource status
from the aps:ready
to another, typically aps:provisioning
or aps:unprovisioning
. This protects the resource
from starting another process with it. The APS controller returns the resource status back to aps:ready
by means of the finalizing task. It means you cannot do any operations with the resource until that final task is completed.
For example, if you need to remove a resource because some operation with it failed, try to complete at least
the finalizing task in that failed process. Only after that, you will be able to do something with the resource.
Note
Be careful when canceling tasks. It is better to cancel failed tasks one by one, instead of canceling the whole tree of tasks that depend on each other. This may allow you to complete at least the finalizing task in order to remove the resource.
Diagnostics may consist of several steps. You can finish it on any of the following steps once you clarify the cause of an error.
In the provider control panel, navigate to Operations > Tasks and identify if there is a task related to your issue. There are many search and sort criteria that you can use:
Status
allows you to find tasks by their status, for example, to find all Rescheduled
or Failed
tasks.
Name
contains the APS application name and thus allows you to use a partial name pattern to filter the tasks.
Sorting by ID
helps you to find the latest tasks.
Queue name
helps you filter all APS tasks by the aps_application_instance
prefix. It also contains the instance ID
and subscription ID to narrow your search.
Investigate closely the execution output of the task. It makes sense not to close the screen with this output if you think that some key words in it may help you in your further investigation of backend logs.
Get connected to the management node through SSH.
Investigate the respective REST operations in the apsc.http.log
file. If you can repeat the operation, usually by
running the failed task, print out
the log tail with new appended data. The following command will capture all new log messages and save them in
the test.log
file:
# tail -fn0 /var/log/pa/apsc.http.log > test.log
Once the traced operation is completed, stop the above command execution by pressing the CTRL-C combination on your keyboard
and then open the test.log
file to investigate the collected data.
Keep in mind the log structure and use the following recommendations:
Search by some words or phrases from the task execution message.
Search by the REST operation: “POST”, “PUT”, “GET”, or “DELETE”.
If a REST response contains “500 Internal Server Error”, the fault is on the application endpoint side.
To narrow your search, you can send a REST request in the command line interface from the management node.
Get connected to the endpoint host through SSH.
Investigate the Apache error log. Try to identify which custom PHP method caused the issue.
Search for the incorrect code in the suspected PHP file located in the application endpoint folder. To get more details in the error log, use the Development Mode in the PHP script. To localize the error, print more custom data by using the APS PHP Logger class.
To narrow your search, you can send a REST request in the command line interface from the endpoint host.
In case you experience a UI issue other than a navigation issue, follow these typical diagnostic steps. Most of them require the Debugging Tools in Browser. In the Chrome DevTools, it looks as follows.
On the Console tab, search for an error message.
Usually, an error message contains a link to the line in the source JavaScript code that caused the error.
On the Network tab, search for failed REST requests. If you find such a request, open its detailed profile and investigate its request and response.
On the Source tab, find the JavaScript file that requires investigation. It must be inside one of subfolders
inside the /aps/2/packages/
folder.
Use Breakpoints, Data Watch, and Console Commands to isolate the issue in the JavaScript code.
When debugging a code, you have to do a lot of edit-and-test operations. It would be time consuming to go through the normal application update process. This section explains how to update the code on the system in the most efficient way before you release the APS package.
Preliminary, it requires:
Ensure the Development Mode is enabled on the system.
Identify the Package Location on the management node.
Identify the Package Location on the endpoint host.
Note
If you change an APS type, you have to go through the normal application update process.
Changes in the presentation logic can be done by editing the respective files directly on the management node, in the Package Location:
Metadata in the APP-META.xml
file, for example, navigation section
JavaScript and related files, for example, JSON files, in the ui/
folder
Images, for example, icons, and other custom files, for example, deployment guide
If you changed metadata or JavaScript code, you should refresh the control panel on the browser to take effect.
If you change the provisioning logic of the APS application instance in the scripts/
folder, apply the changes directly
in the Package Location on the endpoint host.
In case the changes do not take effect immediately, remove the typeCache/
subfolder.