question

lucaferrara avatar image
lucaferrara asked

Unity Login Error: could not resolve host

I'm getting an error using LoginWithCustomID using SystemInfo.deviceUniqueIdentifier as uid.

The error message is:

Could not resolve host: {titleID}{Production Environment Url}

where title ID and Production Environment url are the ones set in PlayFabSharedSettings.

The title ID is taken from playfab dashboard project settings, while the Production Environment Url is the default value i've found in the PlayFabSharedSettings (2e706c61796661626170692e636f6d)

I get the error when executing the game on a windows machine I use at work (could it be a firewall related issue?) while I'm not getting it when executing on the macbook I use at home.

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

marcos avatar image marcos commented ·

I have also faced this issue.

Found that when using PlayFabClientAPI.LoginWithFacebook() the flow ends up in PlayFabSettings.cs, calling a method GetFullUrl(string apiCall) that will build the url using the PlayFabSettings TitleId, regardless of the title id I had specified when creating the login request.

This seems to combine with some sort of issue on the Playfab Editor Extensions (I do have selected a TitleId on the dropdown, but it still reports the property as "" until I hit "save" again in the inspector.

The result is the error described in the title of this thread.

I fixed it modifying the GetFullUrl method to receive the titleid and only use the one from settings if the received is null (exactly the same as LoginWithFacebook). It looks really redundant, but this hacks the inconsistence in the SDK. This should not be foxed but refactored.

0 Likes 0 ·
brendan avatar image brendan marcos commented ·

Thanks - our tools team is investigating this. Can you confirm which specific SDK version you're using?

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ brendan commented ·

Marcos:
In Unity, setting the titleId on every request is not necessary.
Please see this code: https://github.com/PlayFab/UnitySDK/blob/master/Source/PlayFabSDK/Client/PlayFabClientAPI.cs#L39
Every login request will automatically grab the titleId from PlayFabSettings.TitleId, and assign it to the request.

Basically, you only need to set the titleId once: PlayFabSettings.TitleId = "titleId";

And moreso, this is THE necessary step. As you discovered, the titleId is part of the PlayFab url, constructed in GetFullUrl. You can't connect to playfab if the titleId isn't part of your url.

In short, please do the easiest thing, and everything will work. Set the titleId once, in PlayFabSettings, and let our code do the rest for you.

1 Like 1 ·
Show more comments
brendan avatar image
brendan answered

Update: We'll have a new release of the SDK available Monday (7/25) which fixes this issue. For now, if you encounter this, please edit the scriptable object to put the correct string (".playfabapi.com") in as the ProductionEnvironmentUrl, that will fix the issue locally.

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

Can you check the value of the ProductionEnvironmentUrl in PlayFabSharedSettings? This issue is almost always that the Url is incorrect.

10 |1200

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

lucaferrara avatar image
lucaferrara answered

Hi, yes that was the problem.

The weird thing is that I've never changed this value. Just after installing the sdk it was set as "2e706c61796661626170692e636f6d" instead of ".playfab.com' and I don't know why.

Can it be related to the fact that I've configured Unity to save .asset files as text files?

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.

brendan avatar image brendan commented ·

We're checking to see if there's an issue in the latest release of the SDK - we'll update shortly.

0 Likes 0 ·
brendan avatar image brendan commented ·

Indeed, we believe we found a potential serialization issue specific to Unity 5.0, 5.1, and 5.2. Could you try updating to our latest SDK, and see if you run into this again?

0 Likes 0 ·
lucaferrara avatar image
lucaferrara answered

Hi, I've just checked on a 'online hash calculator' website and yes: the value it's exactly the hash of ".playfab.com" string :)

That explains why it was working yesterday on my mac, before to save it with git and retrieve today on a different computer.

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

lucaferrara avatar image lucaferrara commented ·

ops sorry not hash but byte code representation.

0 Likes 0 ·
brendan avatar image brendan commented ·

Very nice. We're checking to see what could have caused this, but I suspect yesterday's update to the SDK would resolve this. Can you give that a try and let us know?

0 Likes 0 ·
lucaferrara avatar image lucaferrara brendan commented ·

Latest version with which I've tried was 2.1.160720 and the issue was still present.

0 Likes 0 ·
brendan avatar image brendan lucaferrara commented ·

Thanks - the updated SDK will be available in Git Monday - apologies for the delay, but the correction listed above does fix the issue if you need it now.

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.