question

Jing avatar image
Jing asked

Unity ExecuteFunction error: Cannot connect to destination host

I got this error "Cannot connect to destination host" while calling PlayFabCloudScriptAPI.ExecuteFunction in Unity.

Here's my code:

PlayFabCloudScriptAPI.ExecuteFunction(new ExecuteFunctionRequest()
{
 Entity = new EntityKey()
 {
  Id = PlayFabSettings.staticPlayer.EntityId, //Get this from when you logged in,
  Type = PlayFabSettings.staticPlayer.EntityType, //Get this from when you logged in
 },
 FunctionName = functionName, //This should be the name of your Azure Function that you created.
 FunctionParameter = parameters, //This is the data that you would want to pass into your function.
 GeneratePlayStreamEvent = false //Set this to true if you would like this call to show up in PlayStream
}, (result) =>
{
 if (result.FunctionResultTooLarge ?? false)
 {
  Debug.Log("This can happen if you exceed the limit that can be returned from an Azure Function, See PlayFab Limits Page for details.");
  return;
 }
 Utility.Logger.Log($"The {result.FunctionName} function took {result.ExecutionTimeMilliseconds} to complete");
 Utility.Logger.Log($"Result: {result.FunctionResult.ToString()}");
}, (error) =>
{
 Debug.LogError(
  $"Opps Something went wrong when calling cloudscript {functionName}: {error.GenerateErrorReport()}");
});

What I have checked:
- I don't think it's the network issue because I am able to successfully get title data using PlayFabClientAPI.GetTitleData

- TitleID has been correctly set using PlayFab's unity editor extension

I would appreciate for some help. I have been on this issue all day.

unity3dCloudScript
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

·
Gosen Gao avatar image
Gosen Gao answered

Can this issue be reproduced in restful testing tools like Postman?

If you are local debugging the Azure Function, please make sure the local Azure Function is running properly, and follow the documentation to configure the local project.

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.