Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Cannot construct a Request with a Request object that has already been used. #543

Closed
1 task done
jakub-g opened this issue Apr 24, 2024 · 3 comments
Closed
1 task done
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@jakub-g
Copy link

jakub-g commented Apr 24, 2024

What happened?

Today GitHub had an outage (related: #2) and the API was replying with 500s.

Due to this, the retry plugin has been retrying failed requests in our CI, but those retries were failing with Cannot construct a Request with a Request object that has already been used..

Versions

octokit-request 8.1.4
octokit-plugin-retry 6.0.1
node 20.10.0

Relevant log output

<path-to-repo>/.yarn/__virtual__/@octokit-plugin-retry-virtual-913e8d7a91/0/cache/@octokit-plugin-retry-npm-6.0.1-b38996e6ff-2f5cd8b221.zip/node_modules/@octokit/plugin-retry/dist-node/index.js:71
  const response = await request(request, options);
                   ^
RequestError [HttpError]: Cannot construct a Request with a Request object that has already been used.
    at <path-to-repo>/.yarn/cache/@octokit-request-npm-8.1.4-e871d5ebf1-a51470f470.zip/node_modules/@octokit/request/dist-node/index.js:144:11
    at async requestWithGraphqlErrorHandling (<path-to-repo>/.yarn/__virtual__/@octokit-plugin-retry-virtual-913e8d7a91/0/cache/@octokit-plugin-retry-npm-6.0.1-b38996e6ff-2f5cd8b221.zip/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
    at async Job.doExecute (<path-to-repo>/.yarn/cache/bottleneck-npm-2.19.5-2c6092aa17-084e33d97e.zip/node_modules/bottleneck/light.js:405:18) {
  status: 500,
  request: {
    method: 'PATCH',
    url: 'https://api.github.com/repos/<org>/<repo>/issues/comments/<id>',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/3.1.2 octokit-core.js/5.0.1 Node.js/20.10.0 (linux; arm64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },

The underlying error comes from undici (which is nodejs built-in fetch impl) which is used by octokit/request:

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jakub-g jakub-g added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Apr 24, 2024
Copy link

👋 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 labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@gr2m
Copy link
Contributor

gr2m commented Apr 25, 2024

Could you share a minimal reproducible test case please? I've haven't seen this error before, and I have plenty of request retries across my projects, many of which use latest octokit with the native fetch from unidici

@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Apr 25, 2024
@jakub-g
Copy link
Author

jakub-g commented Apr 29, 2024

@gr2m Thanks for replying - we just realized this is coming from a regression in the dd-trace library. Closing.

@jakub-g jakub-g closed this as completed Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
Archived in project
Development

No branches or pull requests

3 participants