question

chrisk avatar image
chrisk asked

Registered Azure Function is not recognized

Hi.

I've created an Azure function 'Echo' and manually registered it with the Playfab account and confirmed that the system registers it. I did not upload a Cloudscript source file. Then, I've written a Python client to log in with a custom ID and call the cloudscript function.

When I call the function using the Playfab 'Execute Function' call, the call succeeds with the error:

{"Error": "CloudScriptNotFound", "Message": "No function named Echo was found to execute", "StackTrace": ""}

Here's the relevant Python test code...

async def main():
client = PlayfabClient(TITLE_ID_VIM_DUNGEON)

logging.info("Logging in as '{}'...".format(USER_ID))
logged_in = await client.login(USER_ID)
if logged_in:
logging.info("'{}' logged in (Playfab ID: {})".format(USER_ID, client.playfab_id))
else:
logging.error("Login failed.".format(USER_ID))

payload = {
"Test": 123}
logging.info("Calling Cloudscript 'Echo' with payload '{}'...".format(json.dumps(payload)))
success, failure = await client.call_cloudscript("Echo", payload)

if success:
logging.info("Cloudscript success: {}".format(json.dumps(success)))
else:
logging.error("Cloudscript failed: {}".format(json.dumps(failure)))

And here's the 'Execute Function' implementation:

async def call_cloudscript(self, function_name, fn_param=None):
if not self.logged_in:
return None, "Not logged in"callback_result = asyncio.get_running_loop().create_future()

def parse_results(success: dict, failure: dict):
if success:
script_error = success.get("Error")
if script_error is not None:
callback_result.set_result((None, script_error))
else:
callback_result.set_result((success["FunctionResult"], None))

returncallback_result.set_result((None, failure))

request = {
"FunctionName": function_name,"GeneratePlayStreamEvent": True,}

if fn_param is not None:
request["FunctionParameter"] = fn_param

PlayFabClientAPI.ExecuteCloudScript(request, parse_results)

return await callback_result

Any idea what's going wrong here?

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

·
Seth Du avatar image
Seth Du answered

>>confirmed that the system registers

I am not sure what does “system” mean, but have you registered the Azure Function in Game Manager? After the function is uploaded to Azure, you may navigate to [Game Manager] -> [Cloud Script] -> [Functions(Preview)] and click the “Register Function” button at the top right corner of the web page. (I am using VS code. Right click the function and select “Copy function Url” may retrieve the function URL in the Azure Extension page)

3 comments
10 |1200

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

chrisk avatar image chrisk commented ·

Yes, I confirmed that the Function is properly registered in the web dashboard.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ chrisk commented ·

Thanks for the feedback. May I have your title ID so that I can dig into it.

0 Likes 0 ·
chrisk avatar image chrisk Seth Du ♦ commented ·

Thanks, @SethDu.

I was able to contact Playfab support to figure out the issue - at this time, external Cloudscript functions are only supported via Azure Functions.

I'm was using AWS Lambda and manually registering the function. That's not supported.

The Playfab title ID is 7D992

0 Likes 0 ·

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.