question

DH Kim avatar image
DH Kim asked

UriFormatException: Invalid URI: The hostname could not be parsed.

I have run the code PlayFabLogin from playfab unity tutorial, and it throws the log below.

I found that this exception is for wrong uri on PlayFabSharedSettings.

But I had put Title Id, Developer Secret Key, Production Environment Uri properly and double checked it before and after running this code.

No other scripts exists on the scene because it's very beginning of this project.

My unity version is 2019.2.17.f1

and playfab sdk version is 2.79.191218

UriFormatException: Invalid URI: The hostname could not be parsed. UnityEngineInternal.WebRequestUtils.MakeInitialUrl (System.String targetUrl, System.String localUrl) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/WebRequestUtils.cs:540) UnityEngine.Networking.UnityWebRequest.set_url (System.String value) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:400) UnityEngine.Networking.UnityWebRequest..ctor (System.String url) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:162) PlayFab.Internal.PlayFabUnityHttp+<Post>d__12.MoveNext () (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:127) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) PlayFab.Internal.PlayFabUnityHttp:MakeApiCall(Object) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:117) PlayFab.Internal.PlayFabHttp:_MakeApiCall(String, String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, Boolean, PlayFabAuthenticationContext, PlayFabApiSettings, IPlayFabInstanceApi) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:230) PlayFab.Internal.PlayFabHttp:MakeApiCall(String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, PlayFabAuthenticationContext, PlayFabApiSettings, IPlayFabInstanceApi) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:135) PlayFab.PlayFabClientAPI:LoginWithCustomID(LoginWithCustomIDRequest, Action`1, Action`1, Object, Dictionary`2) (at Assets/PlayFabSdk/Client/PlayFabClientAPI.cs:1228) PlayFabLogin:Start() (at Assets/Scripts/PlayFab/PlayFabLogin.cs:12)

apis
2 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.

Seth Du avatar image Seth Du ♦ commented ·

Can you try to print out the URI before the call is made. In addition, any details or screenshots of your configuration will be helpful.(Please hide personal information)

0 Likes 0 ·
DH Kim avatar image DH Kim Seth Du ♦ commented ·

Hi, thanks for reply. This is my inspector view.

On playfablogin object there's only PlayFabLogin script that I copy and pasted from official document below.

https://api.playfab.com/docs/getting-started/unity-getting-started

0 Likes 0 ·
untitled.jpg (69.3 KiB)

1 Answer

·
Seth Du avatar image
Seth Du answered

I believe the documentation doesn't match the latest SDK changes. Also, it is a tutorial from our legacy documentation website, which won't update frequently (I don't think it will ever update). Please always refer docs on https://docs.microsoft.com/en-us/gaming/playfab/

The Unity tutorial documentation is on https://docs.microsoft.com/en-us/gaming/playfab/sdks/unity3d/quickstart.

In terms of PlayFabSharedSettings configuration file, usually you may just leave the Production Environment Url as blank since the SDK will check the value and "playfabapi.com" will be set by default if empty, which also means you can also remove the initial " . " symbol in the Url to make it work.

2 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.

Seth Du avatar image Seth Du ♦ commented ·

BTW, the Unity Extension will automatically generate this configuration file, hence if it is imported, just edit your title settings there.

0 Likes 0 ·
DH Kim avatar image DH Kim commented ·

cool ! thanks :)

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.