embedded-app-sdk icon indicating copy to clipboard operation
embedded-app-sdk copied to clipboard

`DiscordSDK.ready()` stuck when using URL override

Open RixInGithub opened this issue 1 year ago • 0 comments

        Dear Discord SDK developers.

I am writing this issue to let you know of a yet another bug with the ready function of DiscordSDK. The code inside of the method sends a handshake message and waits for a READY event to be sent by the parent origin. However, with my test code...

void(async function() {
  var idefk = await import("https://unpkg.com/@discord/[email protected]/output/index.mjs")
  var {DiscordSDK} = idefk
  var sdk = new DiscordSDK(CLIENT_ID, {disableConsoleLogOverride: true})
  await sdk.ready()
  alert("h")
})()

...it should alert h. However, it doesn't. Instead, in the console, I see an error complaining about invalid origins, thus stopping the ready from ever finishing, making the h unnoticed.

But when I go check out the activity without URL overriding, it works just fine and the code passes through to the alert("h") statement.

I really hope that you would fix this error. (The discordsays.com proxy caches my activity code which isn't ideal for my testing, which is why I go with URL overriding.)

RixInGithub avatar Jan 01 '25 16:01 RixInGithub