retrouser955 / discord-player-youtubei

Super charging your bot. dpy is a tiny extractor module to test the validity of youtubei.js in discord-player version 7.
https://discord-player.js.org
Creative Commons Zero v1.0 Universal
25 stars 8 forks source link

import_undici.setGlobalDispatcher is not a function. #24

Closed MeewMeew closed 1 month ago

MeewMeew commented 1 month ago

Before you report a bug ...

Description of the bug

27581 | var meta_url = import_meta.url;
27582 | var is_cjs = !meta_url;
27583 | var __dirname__ = is_cjs ? __dirname : import_path.default.dirname((0, import_url.fileURLToPath)(meta_url));
27584 | var { homepage, version, bugs } = { "homepage": "https://github.com/LuanRT/YouTube.js#readme", "version": "10.5.0", "bugs": { "url": "https://github.com/LuanRT/YouTube.js/issues" } };
27585 | var repo_url = homepage == null ? void 0 : homepage.split("#")[0];
27586 | (0, import_undici.setGlobalDispatcher)(new import_undici.Agent({
                          ^
TypeError: import_undici.setGlobalDispatcher is not a function. (In 'import_undici.setGlobalDispatcher(new import_undici.Agent({
    connect: {
      timeout: 60000
    }
  }))', 'import_undici.setGlobalDispatcher' is undefined)
      at E:\disbot-v2\node_modules\youtubei.js\bundle\node.cjs:27586:19
      at E:\disbot-v2\node_modules\discord-player-youtubei\dist\index.js:45:24
  await player.extractors.register(YoutubeiExtractor, {
    authentication: oauthTokens,
    streamOptions: {
      useClient: "ANDROID",
    },
  });

Steps to reproduce

Just do like previous step

Versioning

discord-player: 6.7.1 node.js: latest

retrouser955 commented 1 month ago

I have only tested the extractor on NodeJS LTS and haven't on the latest. This seems to be related to undici being undefined.

EDIT: I have released a new version with the latest version of youtubei.js. Could you try to see if this version works?

retrouser955 commented 1 month ago

Could you try running the command npm install undici and see if that fixes it

retrouser955 commented 1 month ago

I am closing this issue due to inactivity. Will reopen if needed.