How to debug Google Wave Robot and extensions

I have been writing posts on how to develop Google Wave robots. During the process of development of some prototype robots I ran into lot of issues, bugs and what not. Since this is a new framework and still in beta state, so you will be running into more issues than expected. Having the robot hosted on Google app engine cloud adds some challenge itself if you want to debug your robot. And I get questions everybody about debugging of these robots as well. So here is my attempt on putting together some notes and thoughts on debugging a Google wave robot.

Deployment Check

First and foremost, you need to check if your robot has been correctly or not. Here are some steps I follow when I deploy a new robot.

1.Check capabilities.xml

This is a very quick and robot test that will reveal following two things very quickly. In your browser type the URL http://{robotname}.appspot.com/_wave/capabilities.xml. If everything is deployed correctly and working as designed then you should verify following outputs.

  • You do no get 404 status code. If you get 404 (Page not found) then you have deployment issues going on. To resolve this issue, check following things:

    • Your URL is correct.

    • Your robot name is correct.

    • Check in your App Engine dashboard to see if this application has been deployed.

    • Check your code if you are handling requests for this request.

  • You should get a valid capabilities.xml document in response. And this response should contain all the capabilities or events your robot is handling. Here are some common issues that you may run into:

    • You get a blank xml document. Check if you have configured your entry point to robot correctly. One of the common problems I have seen with python implementation is that correct entry point is not provided in app.yaml file. Other problem I run into is that your entry point robot implementation is not correct and is some blank implementation. I have seen this happen when you use Google app engine sdk to create new application.

2. Check profile

If you have provided custom profile or for that matter even if there is some default profile associated with your robot, you can check it. Type this url in your browser, http://{robotname}.appspot.com/_wave/robot/profile. You should get a json response object back that could look something as shown below.


{
  "profileUrl": "http://www.byteblocks.com",
  "imageUrl": "http://wave.byteblocks.com/byteblocksavatar.gif",
  "name": "StockBlocks",
  "javaClass": "com.google.wave.api.ParticipantProfile"
}

If you are handling requests for this URL in your robot and not returning 404 status code, then you should get a response even if its blank document. If you get 404 status code, that would mean that your robot is not configured and implemented correctly.

App Engine Dashboard As Debug Tool

Before I discuss any further, i think this will be good spot to talk about Google App Engine dashboard. This is the place where you will see all your deployed applications, their status etc. If you are seeing errors or problems in your robot, this dashboard is your best friend to get a quick answer to lot of common issues.

  • When you log into your Google app engine application dashboard, you will see Logs link in left pane. Click on it and it will bring a view like below. You can filter your log messages from the filter drop down as shown in the image.


    Another place in dashboard from where you can get details about various requests in your robot is from the summary view. In the CPU load section you can see all the requests that are being sent your robot. You can click on individual URL in that view to get details log about that URL. You can see a sample view of the summary and details log about profile URL in images below.


    A lot of time you will be able to diagnose your problems from this log itself. Following is an example of one of the issues I ran into. I implemented a custom profile for my robot for it to display my avatar and site URL in the profile. But it was not working for me. So I looked at the logs in app engine dash. You can see from the log message below that my robot is throwing 404 error code to the wave client.


    
    11-02 04:31AM 52.458 /_wave/robot/profile 404 82ms 6cpu_ms 0kb gzip(gfe)
    64.233.172.1 - - [02/Nov/2009:04:31:52 -0800] "GET /_wave/robot/profile HTTP/1.1" 404 124
         - "gzip(gfe)" "byteblocks-stocks.appspot.com"
    I 11-02 04:31AM 52.462
    path: <http://wave.byteblocks.com/Stocky.ashx?/_wave/robot/profile>
    I 11-02 04:31AM 52.537
    remote response: 404
    
    

    Just by looking at this message I was able to quickly diagnose the problem. I never implemented a handler for /_wave/robobt/profile. You can read about the details on this in my earlier post Specifying Google wave robot profile data

Implementation problems

This is where some robust error and event logging mechanism will help you greatly. There are couple of tricks I have come up with for my robot implementation. Some of these may or may not apply to your implementation depending on your deployment.

  • Always use structured exception handling around error prone implementation. For that matter since wave api is still in beta state, whole implementation is subject to throw error if underlying data format changes. In your exception handling routines, append detailed stack trace or error messages in the wave itself. But make sure that you this dump configurable so you can turn it on or off from wave itself. In my previous post Google Wave Robot Development Sample I showed how complete .Net stack trace is dumped as new blip in the wave when exceptions occur.
  • Use some instrumentation and logging framework like log4net etc. in your implementation. Log all the errors and warnings in log database(file, or database or event log etc.).
  • Some time unhandled exceptions will occur that may bypass all your safety net. Look in the event logs of your server to see what went wrong.

Get latest code

Yes that is true, the wave api is still in beta state. So always keep your api code updated with latest changes from google code site. I have run into this issue a few times. Just getting latest updates and recompile and redeployment may solve some of the issues that you may be seeing.

More tricks

These are some of the basic diagnostics and debugging steps you can perform to track issues in your robot. There is always some new trick that everybody has. I will keep adding more information to this post as I do some more experiments with this api.

Search

Social

Weather

8.5 °C / 47.3 °F

weather conditions Clear

Monthly Posts

Blog Tags