question

kennyroy avatar image
kennyroy asked

Odd API call error in latest unity - curl 3?

I am getting this low-level error just on the API call GetPlayerProfile in Unity 2019.2.12f1

In this screen shot you can see I am debug.log the string that is being returned from GetFullURL in the Playfab API.

Very odd things about this:

  • Only the single API called GetPlayerProfile throws
  • It's lower-level than anything I've ever seen Unity throw before
  • The API call returns the correct data even with this supposedly malformed URL!
  • Unity WebRequest or HTTP request or custom request all throw same (but again only on this one endpoint).

In the release notes for 2019.2.11f1, Unity mentions deeper logging for WebRequest. I have changed nothing when upgrading, and the game functions exactly the same as well, SO, it could be this API call has had something wrong with it for a while and we never knew because the logging was not there.

I am not seeing anyone else mention this so I don't know if it's unique to my implementation.

Please let me know what is going on.

unity3d
unnamed.png (66.5 KiB)
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.

Citrus Yan avatar image Citrus Yan commented ·

Hi,

Which SDK version are you using? I cannot reproduce the issue that the Client/GetPlayerProfile API throws “<url> malformed” error (I am using Unity 2019.2.12f1, PlayFab SDK 2.77.191029), could you please provide the repro steps for us to investigate?

0 Likes 0 ·
kennyroy avatar image
kennyroy answered

Was able to track it down. So Playfab returns an empty string, and not null, when you do a GetPlayerProfile() and request the player's Avatar Image URL. I was doing a null check and not an empty string check. Empty string was passing my check and then I was doing a webrequest on the empty string to download the avatar texture. Deep webrequest logging is a new thing in unity versions past 2019.2.10f1, so it was happening before, but just not showing me. Now that there is logging there, the empty URL on the webrequest was showing. I now do a simple URL regex on the returned string instead of a null check.

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.

Citrus Yan avatar image Citrus Yan commented ·

Great, I wasn't aware that there was something wrong with the Avatar image URL.

0 Likes 0 ·
kennyroy avatar image
kennyroy answered

Unity 2019.2.12f1, PlayFab SDK 2.77.191029,

This is how I'm calling GetProfile

public static void GetPlayerProfile(string id)
        {
            var request = new GetPlayerProfileRequest
            {
                PlayFabId = id, 
		ProfileConstraints = new PlayerProfileViewConstraints 
		{
			ShowAvatarUrl = true,
			 ShowDisplayName = true
		}
                
            };


            PlayFabClientAPI.GetPlayerProfile(request, OnGetPlayerProfile, OnPlayFabError);
        }

It only happens in Unity later than 2019.2.10f1

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.

Citrus Yan avatar image Citrus Yan commented ·

Hi,

I tried the code you provided using Unity Web Request, Http Web Request, and Unity Www. However, I don't receive the error, I am using Unity 2019.2.12f1, PlayFab SDK 2.77.191029. It doesn't look like a PlayFab issue.

0 Likes 0 ·
kennyroy avatar image
kennyroy answered

Ok thanks, I've raised a bug with Unity too.

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.

Citrus Yan avatar image Citrus Yan commented ·

Hi @kennyroy,

Did you get any feedback from them?

0 Likes 0 ·
kennyroy avatar image kennyroy Citrus Yan commented ·

Not yet, the issue I'm having is that it is VERY low level, those look like memory addresses in the error log if I'm not mistaken. And I had no idea that Unity used php for webrequests under the hood? Otherwise where is the curl error coming from?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan kennyroy commented ·

Sorry, I am not familiar with this, we may need to hear from the Unity team.

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.