1

I have a mirror API based app in which i have assigned a custom menu item, clicking on which should insert a new card. I have a bit of problem in doing that. I need to know of ways i can debug this.

  1. Check if the subscription to the glass timeline was successful.
  2. Print out something on console on click of the menu.
  3. Any other way i can detect whether on click of the menu, the callback URL was called or not.
Chirag
  • 335
  • 2
  • 3
  • 13
  • What platform/language is your server-side callback script on? Generally you would have to check the server logs to see if any incoming requests arrived, and you can add some server-side logging to your script with more information if necessary. – Scarygami Apr 07 '14 at 12:32
  • Can you update your question with some code to illustrate how you are subscribing, how you are adding the custom menu, and how you are handling the callback? – Prisoner Apr 07 '14 at 13:41
  • I have posted the code in my other question [here](http://stackoverflow.com/questions/22755140/detecting-a-user-action-on-a-custom-menu-to-insert-cards-in-a-bundle). – Chirag Apr 08 '14 at 05:41

1 Answers1

1

It sounds like you have a problem, but aren't sure how to approach debugging it? A few things to look at and try:

Question 1 re: checking subscriptions

The object returned from the subscriptions.insert should indicate that the subscription is a success. Depending on your language, an exception or error would indicate a problem.

You can also call subscriptions.list to make sure the subscriptions are there and are set to the values you expect. If a user removes authorization for your Glassware, this list will be cleared out.

Some things to remember about the URL used for subscriptions:

  1. It must be an HTTPS URL and cannot use a self-signed certificate
  2. The address must be resolvable from the public internet. "localhost" and local name aliases won't work.
  3. The machine must be accessible from the public internet. Machines with addresses like "192.168.1.10" probably won't be good enough.

Question 2 re: printing when clicked

You need to make sure the subscription is setup correctly and that you have a webapp listening at the address you specified that will handle POST operations at that URL. The method called when that URL is hit is up to you, of course, so you can add logging to it. Language specifics may help here.

Try testing it yourself by going to the URL you specify using your own browser. You should see the log message printed out, at a minimum.

If you want it printed for only the specific menu item, you will need to make sure you can decode the JSON body that is sent as part of the POST and respond based on the operation and id of the menu item.

You should also make sure you return HTTP code 200 as quickly as possible - if you don't, Google's servers may retry for a while or eventually give up if they never get a response.

Update: From the sample code you posted, I noticed that you're either logging at INFO or sending to stdout, which should log to INFO (see https://developers.google.com/appengine/docs/java/#Java_Logging). Are you getting the logging from the doGet() method? This StackOverflow question suggests that appengine doesn't display items logged at INFO unless you change the logging.properties file.

Question 3 re: was it clicked or not?

Depending on the configuration of your web server and app server, there should be logs about what URLs have been hit (as noted by @scarygami in the comments to your question).

You can test it yourself to make sure you can hit the URL and it is logging. Keep in mind, however, the warnings I mentioned above about what makes a valid URL for a Mirror API callback.

Update: From your comment below, it sounds like you are seeing the URL belonging to the TimelineUpdateServlet is being hit, but are not seeing any evidence that the log message in TimelineUpdateServlet.doPost() is being called. What return code is logged? Have you tried calling this URL manually via POST to make sure the URL is going to the servlet you expect?

Community
  • 1
  • 1
Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thank you for the detailed answer. I am using Google App Engine for the same. The log lists the callback url when i click on the custom menu. But it doesn't log anything i print. It would be of great help if you can have a look at my code that i posted in the question [here](http://stackoverflow.com/questions/22755140/detecting-a-user-action-on-a-custom-menu-to-insert-cards-in-a-bundle) and tell me where have i gone wrong. – Chirag Apr 08 '14 at 07:07
  • two comments added above – Prisoner Apr 10 '14 at 10:16