Getting this error:
LogPlayFab: Response : {"code":200,"status":"OK","data":{"FunctionName":"ManageInventory","Revision":236,"FunctionResult":{"error":"An error occurred during inventory management"},"Logs":[{"Level":"Info","Message":"Current PlayFab ID: [object Object]"},{"Level":"Info","Message":"Attempting to manage inventory for PlayFab ID: [object Object]"},{"Level":"Error","Message":"PlayFab API request error","Data":{"api":"/Inventory/ExecuteInventoryOperations","request":{"Entity":{"Id":{"PlayerProfile":{"PublisherId":"33D95BF6C24D18B5","TitleId":"E4875","PlayerId":"B4D8CF94E61675B0","DisplayName":"888888
"}},"Type":"title_player_account"},"Operations":[{"Add":{"Item":{"Id":"95713627-e963-4356-a9b6-bf47c1b0560e"},"Amount":1}},{"Remove":{"Item":{"Id":"269f32a7-9bc7-41a5-b4f9-6c805e0a27c5"},"Amount":1}}]},"result":null,"apiError":**{"code":400,"status":"BadRequest","retryAfterSeconds":null,"error":"InvalidRequest","errorCode":1071,"errorMessage":"Invalid JSON in request","errorHash":"0892dc8df9125426190e0ad6a1ce4075490da75495e065cd870349a3ff41221b","errorDetails":{"ValidationError":["Unexpected character encountered while parsing value: {. Path 'Entity.Id', line 1, position 17."]}}}},**{"Level":"Erro
r","Message":"Error in ManageInventory function: undefined"}],"ExecutionTimeSeconds":0.079836,"ProcessorTimeSeconds":0.00293,"MemoryConsumedBytes":23488,"APIRequestsIssued":2,"HttpRequestsIssued":0}}
Using this code:
handlers.ManageInventory = function (args, context) {
try {
var playFabId = server.GetPlayerProfile({ PlayFabId: currentPlayerId });
log.info("Current PlayFab ID: " + playFabId); // Debugging log statement
// Validate PlayFab ID
if (!playFabId) {
log.error("Invalid PlayFab ID.");
return { error: "Invalid PlayFab ID" };
}
log.info("Attempting to manage inventory for PlayFab ID: " + playFabId);
// Step 3: Execute operations using executeInventoryOperations or similar function
var executeRequest = economy.ExecuteInventoryOperations({
"Entity": { "Id": playFabId, "Type": "title_player_account" },
"Operations": [
{ "Add": { "Item": { "Id": "95713627-e963-4356-a9b6-bf47c1b0560e" }, "Amount": 1 } }, // Replace with your actual item IDs and amounts
{ "Remove": { "Item": { "Id": "269f32a7-9bc7-41a5-b4f9-6c805e0a27c5" }, "Amount": 1 } }
]
});
log.debug("Execute Request:", executeRequest); // Debugging log statement
log.info("Inventory management successful.");
return executeResult; // Return the result of executing the operations
} catch (ex) {
log.error("Error in ManageInventory function: " + ex.message);
return { error: "An error occurred during inventory management" };
}
};
Could someone please tell me how I am screwing this up so badly? I am wracking my brain atm.