question

Greg Quinn avatar image
Greg Quinn asked

Playstream always returns 400 BAD REQUEST when calling Queue Trigger Azure Function

I can't find anything in the documentation or examples on Github on how to setup a Queue Trigger function that can be called by Playstream.

My Function code looks like this...

[FunctionName("SaveNewPlayerData")]
public static Task RunAsync([QueueTrigger("myqueue")] string msg, ILogger log)
{
    log.LogInformation($"C# Queue trigger function processed: {msg}");
    
    PlayerPlayStreamFunctionExecutionContext playStreamRequest = JsonConvert.DeserializeObject<PlayerPlayStreamFunctionExecutionContext>(msg);

    log.LogInformation($"playStreamRequest playerId: {playStreamRequest.PlayerProfile.PlayerId}");

    return Task.CompletedTask;
}

I have registered the Queue function in Playfab, with the following settings...

The connection string points to my functions storage.

But I get the following 400 Bad Request response from PlayStream, when Playstream tries to call it...

I can't even debug the function in The Azure Portal, it doesn't even get hit.

{
    "EventName": "player_action_executed",
    "ActionName": "Execute Cloud Script Azure Function",
    "TriggeringSegmentMembershipChange": null,
    "TriggeringEventRuleMatch": {
        "RuleId": "EFC5CFD7D0D44DD1",
        "EventId": "39fecf30583e47c4a37263027c395fa2"
    },
    "TriggeredTimestamp": "2021-08-27T23:49:14.0581238Z",
    "ScheduledTimestamp": "2021-08-27T23:49:14.6046969Z",
    "ExecutionResult": {
        "ExecutionResult": {
            "Error": {
                "code": 400,
                "status": "BadRequest",
                "error": "CloudScriptAzureFunctionsQueueRequestError",
                "errorCode": 1494,
                "errorMessage": "Invocation of cloud script function SaveNewPlayerData failed, ClientRequestId: 93b45751-849a-41aa-b7f0-d34495ed2050"
            },
            "Status": 400
        }
    },
    "Error": {
        "Error": null,
        "Message": "Invocation of cloud script function SaveNewPlayerData failed, ClientRequestId: 93b45751-849a-41aa-b7f0-d34495ed2050"
    },
    "ExecutionDuration": 336.8543,
    "EventNamespace": "com.playfab",
    "EntityType": "player",
    "Source": "PlayFab",
    "TitleId": "67909",
    "EntityId": "FF75C868FB3F8EE9",
    "EventId": "f0ecf84ff9604bf5b22788484a23221a",
    "SourceType": "BackEnd",
    "Timestamp": "2021-08-27T23:49:14.6365476Z",
    "History": null,
    "CustomTags": null,
    "Reserved": null,
    "PlayFabEnvironment": {
        "Vertical": "master",
        "Cloud": "main",
        "Application": "actionprocessor",
        "Commit": "dc867fd"
    }
}
1jeva.png (30.2 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Greg Quinn avatar image
Greg Quinn answered

I figured out the issue, I needed to add the queue to my storage account first in the Azure Portal...

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.