Execution of retrieveApplicationInfo fails if incorrect value is set in OAuth2 Redirects in DDev
Closed this issue ยท 7 comments
General Troubleshooting
- I have checked for similar issues on the Issue-tracker.
- I have checked for PRs that might already address this issue.
Version of JDA
5.1.0 (5.0.0-beta.20 or later to be exact)
Expected Behaviour
It is very rare, but by leaving the value blank in the Developer Portal's settings for OAuth2 redirect URLs, the redirect_uris
in the GET /oauth2/applications/@me
response will return [null]
, which will cause the EntityBuilder.java fails to parse JSON.
Code Example for Reproduction Steps
- Access
https://discord.com/developers/applications/<BOT ID>/oauth2
and save the settings as per image. (Normally, it is desirable that the validation fails and saving is not possible, but this problem occurs because the Discord side does not correct it.) - Include
retrieveApplicationInfo().queue()
in the code and start the bot.
Code for JDABuilder or DefaultShardManagerBuilder used
val instance = DefaultShardManagerBuilder.create(
"BOT TOKEN",
GatewayIntent.GUILD_MEMBERS,
GatewayIntent.GUILD_MODERATION,
GatewayIntent.GUILD_EMOJIS_AND_STICKERS,
GatewayIntent.GUILD_WEBHOOKS,
GatewayIntent.GUILD_INVITES,
GatewayIntent.GUILD_VOICE_STATES,
GatewayIntent.GUILD_PRESENCES,
GatewayIntent.GUILD_MESSAGES,
GatewayIntent.GUILD_MESSAGE_REACTIONS,
GatewayIntent.DIRECT_MESSAGES,
GatewayIntent.DIRECT_MESSAGE_REACTIONS,
GatewayIntent.MESSAGE_CONTENT,
GatewayIntent.SCHEDULED_EVENTS
)
.setShardsTotal(-1)
.setStatus(OnlineStatus.DO_NOT_DISTURB)
.setActivity(Activity.playing("Loading..."))
.setChunkingFilter(ChunkingFilter.ALL)
.setMemberCachePolicy(MemberCachePolicy.ALL)
.setRawEventsEnabled(true)
.setRestConfig(RestConfig().setRelativeRateLimit(false))
.setBulkDeleteSplittingEnabled(false)
.setCallbackPool(Executors.newCachedThreadPool(), true)
.build()
Exception or Error
net.dv8tion.jda.internal.requests.Requester : There was an unexpected error while executing a REST request
net.dv8tion.jda.api.exceptions.ParsingException: Unable to resolve value at 0 to type String: null
at net.dv8tion.jda.api.utils.data.DataArray.valueError(DataArray.java:811) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.api.utils.data.DataArray.getString(DataArray.java:335) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.api.utils.data.DataArray.lambda$stream$0(DataArray.java:853) ~[LunaProject-10.3.6-all.jar:?]
at java.util.stream.IntPipeline$1$1.accept(IntPipeline.java:180) ~[?:?]
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) ~[?:?]
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at net.dv8tion.jda.internal.entities.EntityBuilder.createApplicationInfo(EntityBuilder.java:2528) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.JDAImpl.lambda$retrieveApplicationInfo$25(JDAImpl.java:1164) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.RestActionImpl.handleSuccess(RestActionImpl.java:307) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:285) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:304) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.Requester$WorkTask.handleResponse(Requester.java:442) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.Requester$WorkTask.access$300(Requester.java:378) ~[LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:245) [LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:157) [LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:140) [LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.internal.requests.Requester$WorkTask.execute(Requester.java:406) [LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.execute(SequentialRestRateLimiter.java:477) [LunaProject-10.3.6-all.jar:?]
at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.run(SequentialRestRateLimiter.java:517) [LunaProject-10.3.6-all.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
net.dv8tion.jda.api.exceptions.ErrorResponseException: -1: net.dv8tion.jda.api.exceptions.ParsingException
at net.dv8tion.jda.api.exceptions.ErrorResponseException.create(ErrorResponseException.java:201)
at net.dv8tion.jda.api.requests.Request.createErrorResponseException(Request.java:157)
at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:290)
at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:304)
at net.dv8tion.jda.internal.requests.Requester$WorkTask.handleResponse(Requester.java:448)
at net.dv8tion.jda.internal.requests.Requester$WorkTask.access$400(Requester.java:378)
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:284)
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:157)
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:140)
at net.dv8tion.jda.internal.requests.Requester$WorkTask.execute(Requester.java:406)
at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.execute(SequentialRestRateLimiter.java:477)
at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.run(SequentialRestRateLimiter.java:517)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: net.dv8tion.jda.api.exceptions.ParsingException: Unable to resolve value at 0 to type String: null
at net.dv8tion.jda.api.utils.data.DataArray.valueError(DataArray.java:811)
at net.dv8tion.jda.api.utils.data.DataArray.getString(DataArray.java:335)
at net.dv8tion.jda.api.utils.data.DataArray.lambda$stream$0(DataArray.java:853)
at java.base/java.util.stream.IntPipeline$1$1.accept(IntPipeline.java:180)
at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at net.dv8tion.jda.internal.entities.EntityBuilder.createApplicationInfo(EntityBuilder.java:2528)
at net.dv8tion.jda.internal.JDAImpl.lambda$retrieveApplicationInfo$25(JDAImpl.java:1164)
at net.dv8tion.jda.internal.requests.RestActionImpl.handleSuccess(RestActionImpl.java:307)
at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:285)
at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:304)
at net.dv8tion.jda.internal.requests.Requester$WorkTask.handleResponse(Requester.java:442)
at net.dv8tion.jda.internal.requests.Requester$WorkTask.access$300(Requester.java:378)
at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:245)
... 8 more
Caused by: net.dv8tion.jda.api.exceptions.ContextException
at net.dv8tion.jda.api.exceptions.ContextException.here(ContextException.java:54)
at net.dv8tion.jda.api.requests.Request.<init>(Request.java:77)
at net.dv8tion.jda.internal.requests.RestActionImpl.queue(RestActionImpl.java:203)
at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:573)
at jp.lunaproject.bot.Main.loadBot(Main.kt:344)
at jp.lunaproject.bot.Main.main(Main.kt:257)
Please report this bug to discord, JDA expects discord to send valid data here.
There is a similar issue at discord/discord-api-docs#6999
To be clear I'd still make a new issue as returning an array with a null inside it is definitely weird, and not document-able imo
Thank you both for your responses.
I would like to post on the Discord side of this issue.
*I'm using a translation, so I apologize if I'm taking the wrong meaning.
You can avoid the issue by removing the blank redirect URI
In fact, that is true, and if you ask me if the JDA side needs to make a correction because this problem can be avoided by reviewing the portal settings, I honestly don't think it is necessary.
However, I just updated the JDA and this problem occurred, so I thought I should post the issue just in case.
I tried to post the Issue in this manner.
discord/discord-api-docs#7101
Closing since upstream bug appears to be fixed.