We had a 90 min pairing session. Lisi was very calm, composed and very organized in her approach. I had already cloned the restful booker platform application onto my laptop but was having trouble running the server with the following error:
Waiting for RBP to turn onError: Unable to access jarfile room/target /restful-booker-platform-room-*-SNAPSHOT.jar
Error: Unable to access jarfile assets/api/target/restful-booker- platform-assets-*-SNAPSHOT.jar
Error: Unable to access jarfile message/target/restful-booker- platform-message-*-SNAPSHOT.jar
Error: Unable to access jarfile booking/target/restful-booker- platform-booking-*-SNAPSHOT.jar
On looking closer, Lisi found this error in the console:
Error: Cannot find module 'http-proxy'
Then she told me to check the prerequisites for this application, which were:
Node should be 12.0.3 and npm should be 6.12.0 But I was running an upgraded version of the same, which we thought shouldn’t be throwing that error.
When we googled the error, there was someone who had run into the same issue, a couple of months back and the fix was to do:
npm install http-proxy
I kicked off the script(./run_locally.sh) and ran into the same error that it was unable to access the jarfile but viola the http-proxy error had disappeared! Looks like we were 1 step closer.
Also in the prerequisites, we found that Java should be 1.8 and I realized my JAVA_HOME wasn’t set or probably got deleted by mistake. Once I fixed that, then we ran into another error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 2.3.2:compile
Lisi suggested to open the pom.xml to understand the dependencies better and this is what we found:
She was quick to point out that the source and target were pointing to Java 11 while the pre-requisites stated Java 8 and that’s the version I had installed. Also since I had other projects on my laptop, I didn’t want to mess up the config and we decided to update the source and target to point to 8 instead and give it a try.
Now since this application was a microservice based architecture, each service had its own pom.xml and I had to update the version in all the pom.xml files. After that, I kicked off the script and it worked!
We got the application running after debugging for 60 mins and we were so excited! :)
Now it was time to understand how to test these APIs. We used postman to test a couple of endpoints.
We had to pass the username and password as provided in the controller to get the auth token as the response:
Create a room:
We used the auth token retrieved from the previous endpoint and passed it as one of the headers to create a room:
Viola, a new room has been added!
Overall, I had an amazing session with Lisi, exploring the restful-booker APIs! Learnt how to explore an open sourced API in just 90 mins. How cool is that?!
My key takeaways are:
- Look at logs with a keen eye. What you think as an unrelated error could be causing the catastrophic failure! Take the first step to resolve it.
- 90% of the time it is always environmental issues !
- Rinse and repeat! The more you expose yourself to new codebases, the easier it will become to get acquainted soon.
Huge thanks to Lisi for spending her valuable time, pairing with me!