By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Amazon GameSparks

Sort by most recent
  • 1
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

GameSparks().DynamoDB().QueryIndex example please

Can someone provide a working example of using QueryIndex in GameSparks cloud code for handler in an Event. I'm attempting to return a list of players in a lobby querying my table named BattleRoyalePlayerLobbyTable, with lobbyId, playerId as complex key, and index named lobbyId-index with primary key as lobbyId, using message.lobbyId passed in the request message. ``` try { const tableName = "BattleRoyalePlayerLobbyTable"; const indexName = 'lobbyId-index'; const keyConditionExpression = "lobbyId = :lobbyid"; const expressionAttributeNames = null; const expressionAttributeValues = { ":lobbyid": {"S": message.lobbyId} }; const exclusiveStartKey = null; let queryResult = GameSparks().DynamoDB().QueryIndex( tableName, indexName, keyConditionExpression, expressionAttributeNames, expressionAttributeValues, exclusiveStartKey); GameSparks().Logging().Info(queryResult.ToString()); return GameSparks().Messaging.Response({ "players": queryResult.Items }); } catch (ex) { return GameSparks().Messaging().Response({ "players": [], "error": ex.message }); } ``` ``` Response received Id: 56f05f7b-65ed-43b7-a8e4-8390dc9faf0e Type: Custom.Game.GetPlayersInLobby Category: Response ResponseTo: 92f4562c-cf9e-4f7a-ac13-444e31b1c93b {"players":[],"error":"javaException.getCustomerFacingExceptionDetails is not a function"} Request sent Id: 92f4562c-cf9e-4f7a-ac13-444e31b1c93b Type: Custom.Game.GetPlayersInLobby Category: Request {"lobbyId":"fb3578b6797848448d5facca5555d12c"} ``` Thank you
1
answers
0
votes
30
views
asked 4 months ago
  • 1
  • 12 / page