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

Imposible to connect to Discord #13

Open
CarlosNunezMX opened this issue May 29, 2022 · 23 comments
Open

Imposible to connect to Discord #13

CarlosNunezMX opened this issue May 29, 2022 · 23 comments

Comments

@CarlosNunezMX
Copy link

When I start the app with all required flags that shows this errors

error: Uncaught (in promise) RangeError: IPC ID must be between 0-9
  if (id < 0 || id > 9) throw new RangeError(`IPC ID must be between 0-9`);
                              ^
    at getIPCPath (https://deno.land/x/[email protected]/src/util.ts:14:31)
    at findIPC (https://deno.land/x/[email protected]/src/util.ts:30:16)
    at findIPC (https://deno.land/x/[email protected]/src/util.ts:41:12)
    at async Function.connect (https://deno.land/x/[email protected]/src/conn.ts:40:18)
    at async Client.connect (https://deno.land/x/[email protected]/src/client.ts:85:16)
    at async file:///home/kuromi/Angel%20Beats!%20-1st%20beat-/rpc/index.ts:18:1

I give this flags

deno run --allow-run --allow-env --unstable --allow-read --allow-write --allow-net index.ts

And this is the connection part

const cliente = new Client({
    id: "980253379139891292",
    scopes: ["rpc"]
})

await cliente.connect();
@Helloyunho
Copy link
Member

Hmm.. That's weird
Can you check what path comes out from running the code below?

(Deno.env.get("XDG_RUNTIME_DIR") ?? Deno.env.get("TMPDIR") ?? Deno.env.get("TMP") ?? Deno.env.get("TEMP") ?? "/tmp")

And also check if there's something called discord-ipc-(number) in that directory

@Preta-Crowz
Copy link

Hmm.. That's weird Can you check what path comes out from running the code below?

(Deno.env.get("XDG_RUNTIME_DIR") ?? Deno.env.get("TMPDIR") ?? Deno.env.get("TMP") ?? Deno.env.get("TEMP") ?? "/tmp")

And also check if there's something called discord-ipc-(number) in that directory

Got same error, and there's no file/directory named like that under temp folder (tried to restart discord few times, but they don't generate it)

@Helloyunho
Copy link
Member

Hmm.. That's weird Can you check what path comes out from running the code below?

(Deno.env.get("XDG_RUNTIME_DIR") ?? Deno.env.get("TMPDIR") ?? Deno.env.get("TMP") ?? Deno.env.get("TEMP") ?? "/tmp")

And also check if there's something called discord-ipc-(number) in that directory

Got same error, and there's no file/directory named like that under temp folder (tried to restart discord few times, but they don't generate it)

@Preta-Crowz can you try with this? https://raw.githubusercontent.com/harmonyland/discord_rpc/not-found-patch/mod.ts

@Preta-Crowz
Copy link

@Preta-Crowz can you try with this? https://raw.githubusercontent.com/harmonyland/discord_rpc/not-found-patch/mod.ts

Got same error

@DjDeveloperr
Copy link
Member

Which OS are you on?
And what directory does that expression return?
Can you check what each part of it returns? Maybe there is priority issue in looking up tmpdir path.

@Preta-Crowz
Copy link

Which OS are you on? And what directory does that expression return? Can you check what each part of it returns? Maybe there is priority issue in looking up tmpdir path.

Windows 11 21H2, C:\\Users\\preta\\AppData\\Local\\Temp

@DjDeveloperr
Copy link
Member

Right then the issue isn’t temp dir, Windows support is not working once again because FFI bindings are outdated. I’ll update them when I have time and release new version of deno namedpipe.

@DjDeveloperr
Copy link
Member

Try again with v0.3.1, it should work.

@viztea
Copy link

viztea commented Jan 8, 2023

I'm getting the same error on Windows 10 22H2 w/ 0.3.1

cli

deno run --unstable --allow-all mod.ts

temp dir

C:\\Users\\Gino\\AppData\\Local\\Temp

@Preta-Crowz
Copy link

Try again with v0.3.1, it should work.

sorry for late, it's still not working with another error

  return lpBufferView.getCString();
                      ^
    at UnsafePointerView.getCString (deno:ext/ffi/00_ffi.js:117:18)
    at FormatMessage (https://deno.land/x/[email protected]/error.ts:20:23)
    at new Win32Error (https://deno.land/x/[email protected]/error.ts:28:23)
    at unwrap (https://deno.land/x/[email protected]/error.ts:41:11)
    at NamedPipe.write (https://deno.land/x/[email protected]/client.ts:78:5)
    at DiscordIPC.send (https://deno.land/x/[email protected]/src/conn.ts:81:27)
    at https://deno.land/x/[email protected]/src/conn.ts:123:12
    at new Promise (<anonymous>)
    at DiscordIPC.login (https://deno.land/x/[email protected]/src/conn.ts:121:12)
    at Client.connect (https://deno.land/x/[email protected]/src/client.ts:87:20)```

@Helloyunho
Copy link
Member

seems like namedpipe is still having some issues @DjDeveloperr

@DjDeveloperr
Copy link
Member

I'll look into it... it somehow works fine on Windows for me

@pagoru
Copy link

pagoru commented Jun 8, 2024

Still not working...

@DjDeveloperr
Copy link
Member

Can you provide the error you got? @pagoru

@pagoru
Copy link

pagoru commented Jun 15, 2024

@DjDeveloperr
I'm using Deno, when I compile it to production, the problem doesn't occur, it only occurs when I launch it on development. It happens on linux, mac and windows. Maybe a permissions thing?

RangeError: IPC ID must be between 0-9
at getIPCPath (https://deno.land/x/[email protected]/src/util.ts:14:31)
at findIPC (https://deno.land/x/[email protected]/src/util.ts:30:16)
at findIPC (https://deno.land/x/[email protected]/src/util.ts:41:12)
at eventLoopTick (ext:core/01_core.js:168:7)
at async Function.connect (https://deno.land/x/[email protected]/src/conn.ts:40:18)
at async Client.connect (https://deno.land/x/[email protected]/src/client.ts:85:16)
at async _setActivity (file:///home/pagoru/c/voidpixel/game/app/services/src/wss/events/discord/discord-rich-presence.event.ts:30:5)

@DjDeveloperr
Copy link
Member

I think the cause is poor error handling. I'll update the library to show better errors as to why the IPC path could not be found.

@pagoru
Copy link

pagoru commented Jun 15, 2024

I think the cause is poor error handling. I'll update the library to show better errors as to why the IPC path could not be found.

That's really cool, if you need help, ping me! 👯

@DjDeveloperr
Copy link
Member

@pagoru
Copy link

pagoru commented Jun 16, 2024

@pagoru Can you try importing from latest commit i.e. https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/mod.ts ?

RangeError: Tried all possible IPC paths 0-9, make sure Discord is open. It must be installed locally, not just open on a web browser.
at getIPCPath (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:15:11)
at findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:34:16)
at findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:18)
at eventLoopTick (ext:core/01_core.js:168:7)
at async findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:12)
at async findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:12)
at async findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:12)
at async findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:12)
at async findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:12)
at async findIPC (https://raw.githubusercontent.com/harmonyland/discord_rpc/c68f9dde6ddad243f67d252d4409fe1117a98822/src/util.ts:39:12)

@DjDeveloperr
Copy link
Member

DjDeveloperr commented Jun 16, 2024

That is weird. It means that the IPC path simply did not exist on your system... You're on Windows right?
Edit: nvm, you seem to be on Linux from your previous error message.

@DjDeveloperr
Copy link
Member

What do you get when you run this expression in Deno REPL?

(Deno.env.get("XDG_RUNTIME_DIR") ?? Deno.env.get("TMPDIR") ?? Deno.env.get("TMP") ?? Deno.env.get("TEMP") ?? "/tmp")

Does the directory exist? And is there a socket called discord-ipc-{0,9} in it?

@pagoru
Copy link

pagoru commented Jun 17, 2024

(Deno.env.get("XDG_RUNTIME_DIR") ?? Deno.env.get("TMPDIR") ?? Deno.env.get("TMP") ?? Deno.env.get("TEMP") ?? "/tmp")

/run/user/1000

@DjDeveloperr
Copy link
Member

When I check the contents of the path returned by that expression on macOS,

ls -l $(deno eval -p '(Deno.env.get("XDG_RUNTIME_DIR") ?? Deno.env.get("TMPDIR") ?? Deno.env.get("TMP") ?? Deno.env.get("TEMP") ?? "/tmp")') | grep discord

I get this:
image
Can you check the contents?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants