discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Game SDK ClearActivity fails with error code 5 (InvalidPayload)

Open x157 opened this issue 7 months ago • 6 comments

Description

As of SDK 3.2.1, after setting an Activity, later trying to ClearActivity results in the following internal Discord error:

ResponseError { code: InvalidPayload, message: "child \"activity\" fails because [child \"supported_platforms\" fails because [\"supported_platforms\" must contain at least 1 items]]" }

This error was previously reported in Feb 2021 in the now-retired gamesdk-and-dispatch repository.

Steps to Reproduce

Update some activity:

discord::Activity Activity {};
// Set up Activity settings here (omitted for brevity, this part is not the problem)
DiscordCore().ActivityManager().UpdateActivity(Activity, [] (discord::Result Result) {});

Then try to ClearActivity:

DiscordCore().ActivityManager().ClearActivity([] (discord::Result Result) {});

Expected Behavior

I expect that ClearActivity() will actually clear the activity without generating an error.

Current Behavior

  • The activity does not get cleared
  • An internal Discord error message is issued complaining that supported_platforms is not set

Screenshots/Videos

No response

Client and System Information

Win64 UE 5.3 DiscordGameSample project with Discord GameSDK 3.2.1

x157 avatar Jan 09 '24 13:01 x157

For now I #ifdefd out the ClearActivity code since it doesn't do anything other than generate an error.

You can see the exact code to repro here:

https://github.com/XistGG/DiscordGameSample/blob/main/Source/DiscordGameSample/CustomDiscordGameSubsystem.cpp

x157 avatar Jan 09 '24 13:01 x157

This issue is periodically mentioned in the Discord developer discord and each time no one gets any assistance with it. If you search the Discord for "ClearActivity" you'll see tons of results.

For now I'm getting around this by sending up a blanked out activity when I want to clear it, but it would be really good if this issue could get some attention. Even a short sentence explaining the situation would help.

ProbablePrime avatar May 01 '24 05:05 ProbablePrime

https://github.com/discord/discord-api-docs/issues/4938#issuecomment-1161686135 provided an indication that there is a new version of the GameSDK that has "ActivitySupportedPlatformFlags", its likely this will work there.

I'lll, play around I guess.

Why was this new version not documented?

ProbablePrime avatar May 09 '24 04:05 ProbablePrime

Pretty sure that comment is referring to version 3.2.1, which seems to be the one people are having this issue on.

advaith1 avatar May 09 '24 04:05 advaith1

You're right, thank you!

I had multiple editor windows open and was confused.

ProbablePrime avatar May 09 '24 04:05 ProbablePrime

I played around in: https://github.com/ProbablePrime/DiscordRichPresenceClear. This now is a Console App for .NET 8 that shows the issue and therefore constitutes a minimum reproduction case.

I thought setting activity.SupportedPlatforms = (uint)ActivitySupportedPlatformFlags.Desktop;, might help as that's the item from the error message. But alas no, it will still fail.

ProbablePrime avatar May 09 '24 04:05 ProbablePrime