Resolving HTTP 502 Error During Leaderboard API Calls

Mayism
2 min readDec 4, 2020

--

Symptom:

When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.

Log Information

The following error information is displayed in the Android Studio Logcat logs:

2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502

Troubleshooting

The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:

1. First, we ensured that the package name and app ID belong to the same game.

2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.

3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.

Summary:

If you find that the leaderboard function is abnormal, ensure that:

  • The app ID and the package name belong to the same game.
  • Your game has its leaderboard data created in AppGallery Connect.
  • Your test account has been added in AppGallery Connect.

For more details, check:

Adding a Leaderboard:

Managing Tester Accounts:

--

--

No responses yet