question

kerem avatar image
kerem asked

unity3d 2017 UriFormatException: Invalid URI: The hostname could not be parsed. (.playfabapi.com),UriFormatException: Invalid URI: The hostname could not be parsed. (.playfabapi.com)

just updated unity 2017.1 and all i am getting is this error when making an api call

UriFormatException: Invalid URI: The hostname could not be parsed. (.playfabapi.com) System.Uri.Parse (UriKind kind, System.String uriString) System.Uri.ParseUri (UriKind kind) System.Uri..ctor (System.String uriString, Boolean dontEscape) System.Uri..ctor (System.String uriString) System.Net.WebRequest.Create (System.String requestUriString) PlayFab.Internal.PlayFabWebRequest.Post (PlayFab.Internal.CallRequestContainer reqContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:178) Rethrow as Exception: Unhandled exception in Post : https://.playfabapi.com/Client/LoginWithCustomID UnityEngine.Debug:LogException(Exception) PlayFab.Internal.PlayFabWebRequest:Post(CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:218) PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:131)

,

Just updated to unity 2017 and everything gone nuts.

All my api calls are returning this error.

UriFormatException: Invalid URI: The hostname could not be parsed. (.playfabapi.com) System.Uri.Parse (UriKind kind, System.String uriString) System.Uri.ParseUri (UriKind kind) System.Uri..ctor (System.String uriString, Boolean dontEscape) System.Uri..ctor (System.String uriString) System.Net.WebRequest.Create (System.String requestUriString) PlayFab.Internal.PlayFabWebRequest.Post (PlayFab.Internal.CallRequestContainer reqContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:178) Rethrow as Exception: Unhandled exception in Post : https://.playfabapi.com/Client/LoginWithCustomID UnityEngine.Debug:LogException(Exception) PlayFab.Internal.PlayFabWebRequest:Post(CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:218) PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:131)

apisunity3dShared Group Data
10 |1200

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

brendan avatar image
brendan answered

The most common cause of this is not having the Title ID set correctly in the build. The URL endpoint for any call to PlayFab will always be https:{TitleID}.playfabapi.com/... (with the client, server, matchmaker, or admin api reference to follow).

1 comment
10 |1200

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

kerem avatar image kerem commented ·

it worked. Thanks

0 Likes 0 ·
Robert avatar image
Robert answered

I came across the exact same error today after upgrading to Unity 2017.1.0f3, even though I hadn't touched the code. Anytime the SDK updates or in this case, Unity has an update, you'll have to go into the PlayFab settings. I figured where else would it store that info, in my case using the Editor Extension, and noticed that in the Settings tab the Studio had defaulted back to the _Override_ setting. So even if the Title ID is set correctly in the code, as @Brendan said it's the build itself, PlayFab's settings.

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.