I have been working with MTA-based applications for quite some time now and when it comes to troubleshooting deployment issues, I have relied mostly on the log files generated by the application. Sometimes the description log errors can lead you to understand what was wrong and you are able to correct the problem. But there are times as well that the error is too vague. For an experienced ABAP developer, the next step to take is very simple, debug the application even if it is a standard framework/application from SAP.
For the MTA-based applications, I’ve been working mostly with Node.js using many of the out-of-box modules that SAP provide. When there’s a deployment issue, I would take the following steps:
- Look at the applications logs and try to make sense of the error message
- Make the correction and trigger the deployment again
- If the deployment fails again, then repeat starting from step #1
The trial and error process can be painful because the deployment process takes quite awhile depending on the size of your MTA application.
This blog can give you an overview on how to do advanced troubleshooting and debugging your MTA applications using VS Code.
- Visual Studio Code Development IDE
- SAP Cloud Platform Account
- You already know how to connect your local Node.js Application to a HANA HDI Container or you already finished reading this blog: Testing MTA-based app runtime in VS Code
Advanced Debugging in VS Code
In the steps below, I will be using the same MTA Project I used in my previous blog.
- 1. Setup the debug configuration in VS Code: Click on the Debug Panel > Click on the “create a launch.json file”.
- 2a. In the generated launch.json configuration file:
- (1) make sure that the current working directory (cwd) is set to the folder of your Node.js module
- (2) program is set to the path + JS file that used to start the application (usually server.js)
- (3) console is set to the “integratedTerminal”
- 2b. Click the “Run” button and you will see that the debugger is attached to the application server
- 3. Add a breakpoint to the line of code you want to start the debugging > just click on the left side of the line number of the code:
- 4. Trigger the debugging by calling the respective restful webservice (for this case is OData service). The execution should stop at your breakpoint.
Practical Use Case
- My recent use case is when I have followed the hands-on document for the openSAP course Software Development on SAP HANA 2019. I have encountered a persistent error that I don’t know how to solve, and it didn’t look like it was due to the sample code provided in the sample template. It was about the usage of Content-ID in XSODATA.
- Another use case is when troubleshooting the deployment for Fiori Launchpad Sites. The Fiori Launchpad Site (or Portal service) is building and compiling the UI5 files before it is deployed to the HTML5 Application Repository service. In an unusual event, at times there’s an issue that an app ID is already existing in the HTML5 App Repo, the deployment will stop with a hard error. Doing a build and deploy via VS Code, you will be able to see the resulting build and you can analyse the make fo the files before the actual deployment. In this way, you will have higher chances of finding the root cause of the issue.
By now, you have an idea how easy it is to do advance troubleshooting or debugging in VS Code. Being able to do troubleshooting and debugging in a local environment will help you save time fixing deployment issues via trial and error.