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]: @octokit/request-error is not listed in dependencies #436

Closed
1 task done
bryanjtc opened this issue Jun 5, 2023 · 8 comments · Fixed by #440
Closed
1 task done

[BUG]: @octokit/request-error is not listed in dependencies #436

bryanjtc opened this issue Jun 5, 2023 · 8 comments · Fixed by #440
Labels
released Type: Bug Something isn't working as documented
Projects

Comments

@bryanjtc
Copy link

bryanjtc commented Jun 5, 2023

What happened?

The semantic release github plugin uses this package since v8.0.8 for request retries and throttling to prevent rate limit errors.
When running semantic release with yarn pnp, yarn tries to resolve the dependency @octokit/request-error in @octokit/plugin-retry, but is not declared in its dependencies. Yarn pnp needs the dependency declared to resolve it in the dependency tree.

Versions

@octokit/plugin-retry v5.0.0, node v18

Relevant log output

YN0000: [3:04:01 PM] [semantic-release] › ℹ  Running semantic-release version 21.0.3
➤ YN0000: [3:04:02 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: @octokit/plugin-retry tried to access @octokit/request-error, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
➤ YN0000: 
➤ YN0000: Required package: @octokit/request-error
➤ YN0000: Required by: @octokit/plugin-retry@virtual:f494911[8](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5177604521/jobs/9327908914#step:7:9)48e83b18a5cbdfab9cbb572095ac928dbdfe7af76b3453bfd098d16d25b45a390b6756b3ad5af941bc0f6ed515591043b2f1463e134bf65e8e106d83#npm:5.0.0 (via /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/__virtual__/@octokit-plugin-retry-virtual-c6ae7902bf/0/cache/@octokit-plugin-retry-npm-5.0.0-0ca9554243-3ffea3da37.zip/node_modules/@octokit/plugin-retry/dist-node/)
➤ YN0000: 
➤ YN0000: Require stack:
➤ YN0000: - /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/__virtual__/@octokit-plugin-retry-virtual-c6ae7[9](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5177604521/jobs/9327908914#step:7:10)02bf/0/cache/@octokit-plugin-retry-npm-5.0.0-0ca9554243-3ffea3da37.zip/node_modules/@octokit/plugin-retry/dist-node/index.js
➤ YN0000:     at require$$0.Module._resolveFilename (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:17146:13)
➤ YN0000:     at require$$0.Module._load (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:16996:42)
➤ YN0000:     at Module.require (node:internal/modules/cjs/loader:1141:19)
➤ YN0000:     at require (node:internal/modules/cjs/helpers:1[10](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5177604521/jobs/9327908914#step:7:11):18)
➤ YN0000:     at Object.<anonymous> (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/__virtual__/@octokit-plugin-retry-virtual-c6ae7902bf/0/cache/@octokit-plugin-retry-npm-5.0.0-0ca9554243-3ffea3da37.zip/node_modules/@octokit/plugin-retry/dist-node/index.js:53:28)
➤ YN0000:     at Module._compile (node:internal/modules/cjs/loader:1254:14)
➤ YN0000:     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
➤ YN0000:     at require$$0.Module._extensions..js (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:17190:33)
➤ YN0000:     at Module.load (node:internal/modules/cjs/loader:[11](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5177604521/jobs/9327908914#step:7:12)17:32)
➤ YN0000:     at require$$0.Module._load (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:17009:22)
➤ YN0000: Error: @octokit/plugin-retry tried to access @octokit/request-error, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bryanjtc bryanjtc added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Jun 5, 2023
@ghost ghost added this to Bugs in JS Jun 5, 2023
@wolfy1339
Copy link
Member

It's not a runtime dependency, it's only needed for dev.

I don't think that that is the problem.

What is Yarn PNP anyway? Is it a build system?

I think the problem would be that it isn't declared as a type import and then it's getting outputted into the build files

@gr2m gr2m added Type: Support Any questions, information, or general needs around the SDK or GitHub APIs and removed Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Jun 5, 2023
@ghost ghost moved this from Bugs to Support in JS Jun 5, 2023
@wolfy1339
Copy link
Member

Can you test the latest version of this package?

@bryanjtc
Copy link
Author

bryanjtc commented Jun 6, 2023

Yarn pnp is an installation strategy from the package manager yarn that doesn't use node_modules.
I still have the error.

➤ YN0000: [3:13:0[9](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5190279507/jobs/9356483846#step:7:10) PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: @octokit/plugin-retry tried to access @octokit/request-error, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
➤ YN0000: 
➤ YN0000: Required package: @octokit/request-error
➤ YN0000: Required by: @octokit/plugin-retry@virtual:f494911848e83b18a5cbdfab9cbb572095ac928dbdfe7af76b3453bfd098d16d25b45a390b6756b3ad5af941bc0f6ed51559[10](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5190279507/jobs/9356483846#step:7:11)43b2f1463e134bf65e8e106d83#npm:5.0.1 (via /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/__virtual__/@octokit-plugin-retry-virtual-f7b9386581/0/cache/@octokit-plugin-retry-npm-5.0.1-b987477b6a-56a67dacca.zip/node_modules/@octokit/plugin-retry/dist-node/)
➤ YN0000: 
➤ YN0000: Require stack:
➤ YN0000: - /home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/__virtual__/@octokit-plugin-retry-virtual-f7b9386581/0/cache/@octokit-plugin-retry-npm-5.0.1-b987477b6a-56a67dacca.zip/node_modules/@octokit/plugin-retry/dist-node/index.js
➤ YN0000:     at require$$0.Module._resolveFilename (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:17146:13)
➤ YN0000:     at require$$0.Module._load (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:16996:42)
➤ YN0000:     at Module.require (node:internal/modules/cjs/loader:[11](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5190279507/jobs/9356483846#step:7:12)41:19)
➤ YN0000:     at require (node:internal/modules/cjs/helpers:110:18)
➤ YN0000:     at Object.<anonymous> (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.yarn/__virtual__/@octokit-plugin-retry-virtual-f7b9386581/0/cache/@octokit-plugin-retry-npm-5.0.1-b987477b6a-56a67dacca.zip/node_modules/@octokit/plugin-retry/dist-node/index.js:53:28)
➤ YN0000:     at Module._compile (node:internal/modules/cjs/loader:[12](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5190279507/jobs/9356483846#step:7:13)54:14)
➤ YN0000:     at Module._extensions..js (node:internal/modules/cjs/loader:[13](https://github.com/bryanjtc/css-colorguard-upgraded/actions/runs/5190279507/jobs/9356483846#step:7:14)08:10)
➤ YN0000:     at require$$0.Module._extensions..js (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:17190:33)
➤ YN0000:     at Module.load (node:internal/modules/cjs/loader:1117:32)
➤ YN0000:     at require$$0.Module._load (/home/runner/work/css-colorguard-upgraded/css-colorguard-upgraded/.pnp.cjs:17009:22)
➤ YN0000: Error: @octokit/plugin-retry tried to access @octokit/request-error, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

@wolfy1339
Copy link
Member

I don't understand the error, there is nowhere that require() is used to import @octokit/request-error

@bryanjtc
Copy link
Author

bryanjtc commented Jun 6, 2023

Using the code explorer in npm I found that in Line 53 of dist-node/src require is being used to import @octokit/request-error

// pkg/dist-src/wrap-request.js
var import_light = __toESM(require("bottleneck/light"));
var import_request_error = require("@octokit/request-error");
async function wrapRequest(state, octokit, request, options) {
  const limiter = new import_light.default();
  limiter.on("failed", function(error, info) {
    const maxRetries = ~~error.request.request.retries;
    const after = ~~error.request.request.retryAfter;
    options.request.retryCount = info.retryCount + 1;
    if (maxRetries > info.retryCount) {
      return after * state.retryAfterBaseValue;
    }
  });
  return limiter.schedule(
    requestWithGraphqlErrorHandling.bind(null, state, octokit, request),
    options
  );
}

In the original code it is being used in line 3 of the file wrap-request.ts

// @ts-nocheck
import Bottleneck from "bottleneck/light";
import { RequestError } from "@octokit/request-error";
import { errorRequest } from "./error-request";

@wolfy1339
Copy link
Member

Ah yes, I see it now 😅

@wolfy1339 wolfy1339 added Type: Bug Something isn't working as documented and removed Type: Support Any questions, information, or general needs around the SDK or GitHub APIs labels Jun 6, 2023
@ghost ghost moved this from Support to Bugs in JS Jun 6, 2023
@wolfy1339 wolfy1339 changed the title [BUG]: Required package: @octokit/request-error in yarn pnp [BUG]: @octokit/request-error is not listed in dependencies Jun 6, 2023
@atomrevival
Copy link

atomrevival commented Jun 13, 2023

I just started with semantic-release and GH actions for a project and this was a blocker, same problem as above. 😄

@github-actions
Copy link

🎉 This issue has been resolved in version 5.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Type: Bug Something isn't working as documented
Projects
Archived in project
JS
  
Bugs
Development

Successfully merging a pull request may close this issue.

4 participants