discordeno icon indicating copy to clipboard operation
discordeno copied to clipboard

´rest.runMethod()´ error missing important error details

Open Johannes-Andersen opened this issue 2 years ago • 1 comments

Describe the bug

For more context of the entire situation, it is highly recommended to read the Discord thread

Infra: So my plan is to have my k8s cluster with 3 services, discord-Gateway, discord-bot and discord-rest (the one I am working on now)

discord-gateway will do the regular scaling with X amount of pods, which deals with Y amount of shards pr pod. So that's fine discord-rest will be a single pod, but can scale size, just not across pods due to worrying about rate limiting staying in sync across pods then discord-bot is the one that will consume events from discord-gateway and can scale to Z amount of pods Outside of k8s, but on the same VPC, I also have a Postgres DB for caching

Issue: Currently following the bigbot rest example you can see what I want, where if the Discord call fails, the discord-rest server will respond with the Discord body and status code on error

Currently, however, the error does not contain the error code nor any of the discord error. Just that handcrafted message.

To be able for the discord-rest service to respond to discord-bot with the correct error, I would need the discord response proxied to the error.

To Reproduce Write a small mod.ts example to replicate the behavior.

mod.ts: https://gist.github.com/Johannes-Andersen/bff5b722ce7ca9f940652d950aa5aac1 Skjermbilde_2022-07-19_kl _16 06 47

Expected behavior A clear and concise description of what you expected to happen.

The in catch (error) should contain the status code and body of the failed Discord REST call so discord-rest can reject the call with the correct status code and body

Screenshots If applicable, add screenshots to help explain your problem.

Skjermbilde_2022-07-19_kl _15 18 24 Skjermbilde_2022-07-19_kl _15 18 02 Skjermbilde_2022-07-19_kl _15 18 14

Version details (please complete the following information):

  • Deno version: 1.23.3
  • Discordeno version: tried 13.0.0-rc45 and 13.0.0-rc31

Additional context

Discord thread: https://canary.discord.com/channels/785384884197392384/998942266007769120 The template I stole a lot of code from: https://github.com/discordeno/discordeno/blob/main/template/bigbot/src/rest/mod.ts Where the "issue" lies in this repo: https://github.com/discordeno/discordeno/blob/main/rest/runMethod.ts#L26

Johannes-Andersen avatar Jul 19 '22 15:07 Johannes-Andersen

Discordeno version: tried 13.0.0-rc45 and 13.0.0-rc45

@Johannes-Andersen typo?

lts20050703 avatar Jul 19 '22 17:07 lts20050703

Can you please check if this is still happening in the final 13.0.0 release?

Skillz4Killz avatar Sep 01 '22 20:09 Skillz4Killz