When i’am using AddFriendByNameAsync Internal Server Error is coming. I’m trying with friends sample.
Still facing this issue. help me to solve this issue
Have the same Problem
This error occurs on Unity 2022.3.4f1 but not on 2021.3.29f1. Solved by downgrading unity version
I have the same issue, and I am using latest Unity 2021 LTS version (Unity 2021.3.29f1)
The errors occur when running this line of code:
FriendsService.Instance.AddFriendByNameAsync(playerName); //playerName being a string
The above code results in these 2 outputs in Console:
[Friends]: , (24500). Message: Internal Server Error
UnityEngine.Logger:LogError (string,object)
Unity.Services.Friends.Logger:LogError (object) (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/Logger/Logger.cs:15)
Unity.Services.Friends.WrappedFriendsApi:ResolveErrorWrapping (Unity.Services.Friends.Exceptions.RelationshipErrorCode,System.Exception) (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:400)
Unity.Services.Friends.WrappedFriendsApi/d__262<Unity.Services.Friends.Internal.Generated.Relationships.CreateRelationshipRequest, Unity.Services.Friends.Internal.Generated.Models.Relationship>:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:341) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Response1<Unity.Services.Friends.Internal.Generated.Models.Relationship>>:SetException (System.Exception) Unity.Services.Friends.Internal.Generated.Apis.Relationships.RelationshipsApiClient/<CreateRelationshipAsync>d__7:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Apis/RelationshipsApi.cs:126) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.HttpClient/d__1:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:41)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse) Unity.Services.Friends.Internal.Generated.Http.HttpClient/<CreateWebRequestAsync>d__3:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:56) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.In
onary2[TKey,TValue] statusCodeToTypeMap) [0x0006d] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/ResponseHandler.cs:122 at Unity.Services.Friends.Internal.Generated.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse response, System.Collections.Generic.Dictionary
2[TKey,TValue] statusCodeToTypeMap) [0x00000] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/ResponseHandler.cs:226
at Unity.Services.Friends.Internal.Generated.Apis.Relationships.RelationshipsApiClient.CreateRelationshipAsync (Unity.Services.Friends.Internal.Generated.Relationships.CreateRelationshipRequest request, Unity.Services.Friends.Internal.Generated.Configuration operationConfiguration) [0x00149] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Apis/RelationshipsApi.cs:125
at Unity.Services.Friends.WrappedFriendsApi.TryCatchRequest[TRequest,TReturn] (System.Func3[T1,T2,TResult] func, TRequest request) [0x00031] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:337 --- End of inner exception stack trace --- at Unity.Services.Friends.WrappedFriendsApi.ResolveErrorWrapping (Unity.Services.Friends.Exceptions.RelationshipErrorCode reason, System.Exception exception) [0x000e4] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:400 at Unity.Services.Friends.WrappedFriendsApi.TryCatchRequest[TRequest,TReturn] (System.Func
3[T1,T2,TResult] func, TRequest request) [0x0008f] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:341
at Unity.Services.Friends.WrappedFriendsApi.AddFriendByNameAsync (System.String name, Unity.Services.Friends.Options.MemberOptions memberOptions) [0x0009d] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:223
at Unity.Services.Friends.WrappedFriendsService.AddFriendByNameAsync (System.String name) [0x0005a] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsService.cs:137
at Unity.Services.Samples.Friends.RelationshipsManager.SendFriendRequest (System.String playerName) [0x00023] in /Users/thomas/Desktop/Unity5/Network/Network Testing/Assets/UGSSamples/FriendsSample/Scripts/Common/Managers/RelationshipsManager.cs:217 .
UnityEngine.Debug:Log (object)
Unity.Services.Samples.Friends.RelationshipsManager/d__26:MoveNext () (at Assets/UGSSamples/FriendsSample/Scripts/Common/Managers/RelationshipsManager.cs:223)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Models.Relationship>:SetException (System.Exception) Unity.Services.Friends.WrappedFriendsService/<AddFriendByNameAsync>d__36:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsService.cs:145) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Models.Relationship>:SetException (System.Exception)
Unity.Services.Friends.WrappedFriendsApi/d__19:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:227)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Internal.Generated.Response
1<Unity.Services.Friends.Internal.Generated.Models.Relationship>>:SetException (System.Exception)
Unity.Services.Friends.WrappedFriendsApi/d__262<Unity.Services.Friends.Internal.Generated.Relationships.CreateRelationshipRequest, Unity.Services.Friends.Internal.Generated.Models.Relationship>:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:372) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Response1<Unity.Services.Friends.Internal.Generated.Models.Relationship>>:SetException (System.Exception) Unity.Services.Friends.Internal.Generated.Apis.Relationships.RelationshipsApiClient/<CreateRelationshipAsync>d__7:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Apis/RelationshipsApi.cs:126) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.HttpClient/d__1:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:41)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse) Unity.Services.Friends.Internal.Generated.Http.HttpClient/<CreateWebRequestAsync>d__3:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:56) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.HttpClient/d__4:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:84)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse) Unity.Services.Friends.Internal.Generated.Http.HttpClient/<>c__DisplayClass4_0/<<CreateHttpClientResponse>b__0>d:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:81) System.Threading.Tasks.TaskCompletionSource
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.UnityWebRequestHelpers/<>c__DisplayClass0_0:b__0 (UnityEngine.AsyncOperation) (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/UnityWebRequestHelpers.cs:34)
UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/AsyncOperation.cs:21)
Hope to get some help on this issue, as it seem to be a bug
In the example above I use Friends Sample from Unity Asset Store (also tried complete project from Github just in case = same error).
Unity 2021.3.29f1
Friends 1.0.0-pre.1
Authentication 2.6.1
Any suggestions ?
I have now tried the Friends Sample Project with the original setup, which is:
Unity 2021.3.23f1
Friends 1.0.0-pre.1
Authentication 2.5.0-pre.3
Fails in the same way, so this must mean that the fault must be at the server ?
Everything seem to work (login player, set Online presence…), until you submit a friend request.
Failure message:
[Friends]: , (24500). Message: Internal Server Error
UnityEngine.Logger:LogError (string,object)
Unity.Services.Friends.Logger:LogError (object) (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/Logger/Logger.cs:15)
Unity.Services.Friends.WrappedFriendsApi:ResolveErrorWrapping (Unity.Services.Friends.Exceptions.RelationshipErrorCode,System.Exception) (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:400)
Unity.Services.Friends.WrappedFriendsApi/d__262<Unity.Services.Friends.Internal.Generated.Relationships.CreateRelationshipRequest, Unity.Services.Friends.Internal.Generated.Models.Relationship>:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/SDK/WrappedFriendsApi.cs:341) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Response1<Unity.Services.Friends.Internal.Generated.Models.Relationship>>:SetException (System.Exception) Unity.Services.Friends.Internal.Generated.Apis.Relationships.RelationshipsApiClient/<CreateRelationshipAsync>d__7:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Apis/RelationshipsApi.cs:126) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.HttpClient/d__1:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:41)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse) Unity.Services.Friends.Internal.Generated.Http.HttpClient/<CreateWebRequestAsync>d__3:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:56) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.HttpClient/d__4:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:84)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse) Unity.Services.Friends.Internal.Generated.Http.HttpClient/<>c__DisplayClass4_0/<<CreateHttpClientResponse>b__0>d:MoveNext () (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/HttpClient.cs:81) System.Threading.Tasks.TaskCompletionSource
1<Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse>:SetResult (Unity.Services.Friends.Internal.Generated.Http.HttpClientResponse)
Unity.Services.Friends.Internal.Generated.Http.UnityWebRequestHelpers/<>c__DisplayClass0_0:b__0 (UnityEngine.AsyncOperation) (at Library/PackageCache/com.unity.services.friends@1.0.0-pre.1/Runtime/Internal/Generated/Http/UnityWebRequestHelpers.cs:34)
UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/AsyncOperation.cs:21)
Have you tried using Unity 2022? Also, make sure your Friends service is turned On in your Unity Services Dashboard.
Yes I have tried with Unity 2022.3.5f1 & 2022.3.7f1
And yes its turned on in Dashboard.
The FriendsService.Instance.AddFriendByNameAsync(playerName); does not work in any Unity version tested, and throws the same error
What is interesting is that FriendsService.Instance.AddFriendAsync(playerId); does not throw any error and seem to work.
Hello,
we are looking into this issue, however looking very quickly have you ensured that the player you are adding has called either:
await AuthenticationService.Instance.GetPlayerNameAsync();
OR
await AuthenticationService.Instance.UpdatePlayerNameAsync();
this will ensure that the player you are attempting to add has an name assigned to them. Then the friends service should be able to find the player.