Packer =- rate limit on plugins

Friday this was fine, but with no known changes on our side Packer has stopped working with the following error. This is affecting Packer 1.7.10 and Packer 1.9.2:

10:02:27 + packer init template
10:02:27 Failed getting the “github.com/hashicorp/amazon” plugin:
10:02:27 1 error occurred:
10:02:27 * Plugin host rate limited the plugin getter. Try again in 9m19.985478943s. 10:02:27 HINT: Set the PACKER_GITHUB_API_TOKEN env var with a token to get more requests.
10:02:27 GET https://api.github.com/repos/hashicorp/packer-plugin-amazon/git/matching-refs/tags: 403 API rate limit exceeded for 35.163.210.162. (But here’s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) [rate reset in 9m20s]

This is running in AWS. this is happening now on all of our builds, but we’re not running these over and over producing a high load. Why is this happening now? How if the best way to disconnect from github for the plugins (if we need to)?

Hi @asparks2,

This is a problem we’re aware of, and we’re thinking of potential solutions in the upcoming releases (we’re aiming for a summer-time release for this particular problem).

In the meantime, you can try any of the following:

  1. As hinted at in the error you got, you may setup a GITHUB_API_TOKEN in your environment. This way you have a larger amount of requests before you hit the rate-limit: 60 for non-authenticated users vs. 5000 for authenticated, as per the docs. Also please note that though one plugin download is one request, Packer will make several requests before it downloads the zipfile.
  2. You can use an image that already has the plugin installed locally, so you won’t have to download it each time you run a build. This however means that until you don’t update the image, you will not necessarily use the latest version of the plugin.
  3. You can use some shell-fu to get the binaries from a server, and install them using packer plugins install --path, this way you will not hit the Github APIs for each build you run.

Hope that helps.

thanks for the reply. Unfortunately I’m missing something, as to installing a copy of the plugins locally. I’ve created a folder on our builder:

/var/lib/jenkins/.config/packer/plugins/github.com/hashicorp/amazon:
packer-plugin-amazon_v1.0.8_x5.0_linux_amd64
packer-plugin-amazon_v1.0.8_x5.0_linux_amd64_SHA256SUM
packer-plugin-amazon_v1.2.7_x5.0_linux_amd64
packer-plugin-amazon_v1.2.7_x5.0_linux_amd64_SHA256SUM

I’ve tried exporting the environment variable: PACKER_CONFIG_DIR=/var/lib/jenkins/.config/packer

(have checked read permissions, looks OK)

even tried pinning a version in the packer template:
packer {
required_plugins {
amazon = {
version = “= 1.2.7”
source = “github.com/hashicorp/amazon
}
}
}

Still get the rate limit message. Am I missing something? Thanks.
-Alan

I got this working, I needed to use the plugin path environment variable instead.
-Alan