Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug BadRequest (21400)

Discussion in 'Matchmaker' started by huiyu0607, Jul 12, 2023.

  1. huiyu0607

    huiyu0607

    Joined:
    Nov 3, 2019
    Posts:
    2
    Hello. I face a error during CreateTicketAsync

    And I got the error :

    [Matchmaker]: BadRequest (21400)
    Title: Bad Request
    Errors:
    {"players[0].customData":["Deserialized JSON type 'Newtonsoft.Json.Linq.JArray' is not compatible with expected type 'Newtonsoft.Json.Linq.JObject'. Path 'players[0].customData', line 1, position 88."]}
    UnityEngine.Logger:LogError (string,object)
    Unity.Services.Matchmaker.Logger:LogError (object) (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/SDK/Utils/Logger.cs:17)
    Unity.Services.Matchmaker.WrappedMatchmakerService:ResolveErrorWrapping (Unity.Services.Matchmaker.MatchmakerExceptionReason,System.Exception) (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/SDK/WrappedMatchmakerService.cs:322)
    Unity.Services.Matchmaker.WrappedMatchmakerService/<TryCatchRequest>d__14`2<Unity.Services.Matchmaker.Tickets.CreateTicketRequest, Unity.Services.Matchmaker.Models.CreateTicketResponse>:MoveNext () (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/SDK/WrappedMatchmakerService.cs:251)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Response`1<Unity.Services.Matchmaker.Models.CreateTicketResponse>>:SetException (System.Exception)
    Unity.Services.Matchmaker.Apis.Tickets.TicketsApiClient/<CreateTicketAsync>d__7:MoveNext () (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/Apis/TicketsApi.cs:122)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    Unity.Services.Matchmaker.Http.HttpClient/<MakeRequestAsync>d__1:MoveNext () (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/Http/HttpClient.cs:41)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    Unity.Services.Matchmaker.Http.HttpClient/<CreateWebRequestAsync>d__3:MoveNext () (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/Http/HttpClient.cs:56)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    Unity.Services.Matchmaker.Http.HttpClient/<CreateHttpClientResponse>d__4:MoveNext () (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/Http/HttpClient.cs:84)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    Unity.Services.Matchmaker.Http.HttpClient/<>c__DisplayClass4_0/<<CreateHttpClientResponse>b__0>d:MoveNext () (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/Http/HttpClient.cs:81)
    System.Threading.Tasks.TaskCompletionSource`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    Unity.Services.Matchmaker.Http.UnityWebRequestHelpers/<>c__DisplayClass0_0:<GetAwaiter>b__0 (UnityEngine.AsyncOperation) (at ./Library/PackageCache/com.unity.services.matchmaker@1.0.0/Runtime/Http/UnityWebRequestHelpers.cs:34)
    UnityEngine.AsyncOperation:InvokeCompletionEvent ()
     
  2. lucy-unity

    lucy-unity

    Unity Technologies

    Joined:
    Apr 7, 2021
    Posts:
    18
    What is the format of the CustomData you are sending for the first player?

    The expected format is a key-value dictionary but it seems like the CustomData actually sent may be an array.