warrensbox/tgswitch

0.1.170 crashes with "cannot unmarshal object into Go value of type []lib.Repo"

bjbishop opened this issue · 2 comments

Running the 0.1.170 version crashes with this exception.

2019/02/01 10:24:27 json: cannot unmarshal object into Go value of type []lib.Repo
tgswitch --version

Version: 0.1.170

Oh this might be because https://www.terragrunt.io/ is down?

Does tgswitch look at the github release page for terragrunt?
https://github.com/gruntwork-io/terragrunt/releases

This issue was because of the rate limit set the github api.

For unauthenticated requests, the rate limit allows for up to 60 requests per hour. Unauthenticated requests are associated with the originating IP address, and not the user making requests.

If you exceed the rate limit, an error response returns:

HTTP/1.1 403 Forbidden
Date: Tue, 20 Aug 2013 14:50:41 GMT
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1377013266
{
   "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
   "documentation_url": "https://developer.github.com/v3/#rate-limiting"
}

To fix this, I had to register terragrunt-switcher as a github app. Registering a github app provides a client id and secret. Using the client id and secret increases the rate limit to 5000 per hour.
The client id and secret is embedded in the application itself. It is embedded inside the app during build time.

For local testing and development, the client id and secret is optional.

Fixed with the latest release.

Closed #22