0

We are using the Google Homegraph API to implement REQUEST_SYNC functionality for our Google Home project. This has appeared te be working fine in our testing, but recently we noticed that roughly a third of requests are responded to with HTTP codes other than 200.

We have seen the following codes:

  • 400 Bad Request
  • 500 Internal Server Error
  • 429 Too Many Requests
  • 404 Not Found

429 is most likely due to some fault on our part, and we are currently looking into avoiding this. However, we are unable to determine what is causing the other codes.

In our limited ability to test, we have found that it appears to be limited to a specific user each time. Unlinking and re-linking our service seems to fix the issue (if only temporarily).

As a side note, the example here appears to contain invalid JSON, as there are quotation marks missing around agent_user_id. When testing a simple request, the omission or inclusion of the quotation marks didn't affect its success, but this may be confusing to readers.

Does anyone have advice to offer regarding these issues?

EDIT:

We are currently trying to reproduce the issues for an account by purposefully sending many REQUEST_SYNCs. This causes a number of 429 responses (and we've seen a single 500), but it has not yet caused future REQUEST_SYNCs to stop working entirely - previously we saw a user only ever receive 500 response codes until the service was relinked.

Unlinking a user did cause subsequent REQUEST_SYNCs to respond with 404, as expected. Is there a way to be notified when a user is no longer using our Google Home service so that we may stop sending them SYNC requests when they change something about their devices?

1 Answers1

2

A 400 may happen if there's an issue with your server sending data, such as if your agent_user_id has not been established in the Home Graph but you're trying to call something like REQUEST_SYNC.

A 500 may happen if the data you're returning has an issue, like if it doesn't match the schema or is otherwise not formatted correctly.

A 429 may happen if you're hitting the API too often.

A 404 may happen if the URL you're requesting doesn't exist, such as if the API key is invalid or the parameters you're sending are invalid.

If you can identify reproducible cases, it would be easier to find a fix.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • Unfortunately, from our side, these explanations don't always fit what we are seeing. 500 and 404 seem unlikely, as we are always sending the same request. The only difference is the `agent_user_id`. Perhaps a user could have unlinked their service but a `REQUEST_SYNC` was still triggered, this could cause the 400 response. We would need some kind of callback upon "unlinking" to prevent this, does this exist? When testing though, we consistently saw 500 responses for a single user. And after re-linking, the exact same request started working. This would imply an issue on a per-user basis. – Tobias van de Ven Jan 26 '18 at 08:17
  • As of now there is no callback to your server indicating an unlink, but you may be able to track the error codes and interpreting what is happening. – Nick Felker Jan 26 '18 at 20:12