I'm using NodeJS/typescript to create a CloudScript Azure Function called onPlayerRegister
to set up some initial player inventory when a player creates a new account. I've set up the automation Rule, so the played_added_title
event triggers my Azure Function. The function triggers correctly, but I can't figure out how to identify this player on whose behalf the CloudScript function was run.
This is my function, gets triggered by player_added_title
:
import {
app,
HttpRequest,
HttpResponseInit,
InvocationContext,
} from "@azure/functions";
export async function onPlayerRegister(
request: HttpRequest,
context: InvocationContext
): Promise<HttpResponseInit> {
context.log(context);
context.log(request);
return { body: `Hello!` };
}
app.http("onPlayerRegister", {
methods: ["GET", "POST"],
authLevel: "anonymous",
handler: onPlayerRegister,
});
These are the request
and context
parameter values I'm logging in Azure. I can't see any Playfab-related data here. What am I missing?
InvocationContext {
invocationId: 'f8375571-8345-4b51-824f-f740ef9efa7f',
functionName: 'onPlayerRegister',
extraInputs: InvocationContextExtraInputs {},
extraOutputs: InvocationContextExtraOutputs {},
retryContext: undefined,
traceContext: {
traceParent: '00-3cc8c5fcb8b32b8e05ee60c2f96b0408-cc460fb1c10baf52-00',
traceState: '',
attributes: {}
},
triggerMetadata: undefined,
options: {
trigger: {
methods: [Array],
authLevel: 'anonymous',
type: 'httpTrigger',
name: 'httpTrigger2',
direction: 'in'
},
return: {
type: 'http',
name: '$return',
direction: 'out'
},
extraInputs: [],
extraOutputs: []
}
}
HttpRequest {
query: URLSearchParams {},
params: {}
}
How do I identify a player in my NodeJS Azure Function triggered by a 'player_added_title' PlayStream event?