plugin-retry.js icon indicating copy to clipboard operation
plugin-retry.js copied to clipboard

[BUG]: 404 being retried

Open steveoh opened this issue 1 year ago • 5 comments

What happened?

a 404 response code is being retried even though the docs say it shouldn't be.

Retries requests for server 4xx/5xx responses except 400, 401, 403, 404, 422, and 451.

this is how i create the client

import { Octokit } from '@octokit/rest';
import { retry } from '@octokit/plugin-retry';

const EnhancedOctokit = Octokit.plugin(retry);
const octokit = new EnhancedOctokit({
  auth: GITHUB_TOKEN,
  request: { retries: 9 },
});

I've tried adding the codes specifically but that doesn't affect anything

retry: {
    doNotRetry: [400, 401, 403, 404, 422, 451],
  },

Making any of those a string value makes the script run really slow which may be another issue.

This is the function call that 404's and retries 9 times.

const { data } = await octokit.rest.repos.getContent({ owner, repo, path });

Am I doing something wrong?

Versions

npmPackages: @octokit/plugin-retry: ^7.1.1 => 7.1.1 @octokit/plugin-throttling: ^9.3.1 => 9.3.1 @octokit/rest: ^21.0.2 => 21.0.2 prettier: ^3.3.3 => 3.3.3 Binaries: Node: 20.12.2 - ~/.local/state/fnm_multishells/1026_1726157267087/bin/node npm: 10.8.2 - ~/.local/state/fnm_multishells/1026_1726157267087/bin/npm

Relevant log output

GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F268C:3F522F4:66E37921 in 174ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2709:3F523DB:66E37923 in 162ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2777:3F524C2:66E37923 in 167ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F27EE:3F5258D:66E37923 in 169ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F286F:3F52686:66E37923 in 225ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2911:3F527A8:66E37923 in 173ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2989:3F52881:66E37924 in 307ms
GET /orgs/agrc/actions/permissions/selected-actions - 409 with id B0C6:8B43D:E2219C:1AF6512:66E37920 in 155ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2A66:3F52A37:66E37924 in 169ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2AEB:3F52B2B:66E37924 in 181ms
GET /repos/agrc/.github/contents/.github%2Fworkflows - 404 with id 3A06:1D462A:20F2B77:3F52C23:66E37924 in 151ms

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

steveoh avatar Sep 12 '24 23:09 steveoh

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

github-actions[bot] avatar Sep 12 '24 23:09 github-actions[bot]

Can you share details on your environment?

We've seen reports of some implementations not following the specifications, and returning the status code as a string instead of a number

wolfy1339 avatar Sep 13 '24 20:09 wolfy1339

What do you mean by my environment?

steveoh avatar Sep 15 '24 02:09 steveoh

What OS? Are you using a serverless platform like GCF or AWS?

wolfy1339 avatar Sep 15 '24 15:09 wolfy1339

This is MacOS running locally in a terminal.

steveoh avatar Sep 15 '24 20:09 steveoh