Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Matchmaker] BadRequest (21400)

Discussion in 'Unity Gaming Services General Discussion' started by DeathPro, Feb 25, 2023.

  1. DeathPro

    DeathPro

    Joined:
    Jul 28, 2018
    Posts:
    87
    When I try to call the "CreateTicketAsync" callback like in this example, I initialize the Unity Services and authenticate myself previously and Multiplay set up. What things I could miss? I set up the matchmaker in the Unity Dashboard. Do I have to do something else before calling "CreateTicketAsync"?

    Unity: 2021.3.14f1
    Multiplay: 1.0.0-pre.7
    Matchmaker: 1.0.0-pre.14

    Example Code:
    Code (CSharp):
    1. private async Task CreateTicket()
    2.         {
    3.             var attributes = new Dictionary<string, object>();
    4.             var players = new List<Player>
    5.             {
    6.                 new(AuthenticationService.Instance.PlayerId)
    7.             };
    8.          
    9.             // Set options for matchmaking
    10.             var options = new CreateTicketOptions("MainWorld", attributes);
    11.          
    12.             // Create ticket
    13.             var ticketResponse = await MatchmakerService.Instance.CreateTicketAsync(players, options);
    14.  
    15.             // Print the created ticket id
    16.             Debug.LogFormat($"Created ticket with id: {ticketResponse.Id}");
    17.         }
    Errors:


    Code (CSharp):
    1. [Matchmaker]: BadRequest (21400)
    2. Title: Bad Request
    3. Errors:
    4. {"error":["No config found for upid 758efb56-0ce6-46cf-a4ff-ac1eff77c195 and env 4adef20a-8ca3-4acf-b7fc-43a2e817ac82"]}
    5.  
    6. UnityEngine.Logger:LogError (string,object)
    7. Unity.Services.Matchmaker.Logger:LogError (object) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/SDK/Utils/Logger.cs:17)
    8. Unity.Services.Matchmaker.WrappedMatchmakerService:ResolveErrorWrapping (Unity.Services.Matchmaker.MatchmakerExceptionReason,System.Exception) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/SDK/WrappedMatchmakerService.cs:322)
    9. 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-pre.14/Runtime/SDK/WrappedMatchmakerService.cs:251)
    10. System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Response`1<Unity.Services.Matchmaker.Models.CreateTicketResponse>>:SetException (System.Exception)
    11. Unity.Services.Matchmaker.Apis.Tickets.TicketsApiClient/<CreateTicketAsync>d__7:MoveNext () (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Apis/TicketsApi.cs:122)
    12. System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    13. Unity.Services.Matchmaker.Http.HttpClient/<MakeRequestAsync>d__1:MoveNext () (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/HttpClient.cs:41)
    14. System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    15. Unity.Services.Matchmaker.Http.HttpClient/<CreateWebRequestAsync>d__3:MoveNext () (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/HttpClient.cs:56)
    16. System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    17. Unity.Services.Matchmaker.Http.HttpClient/<CreateHttpClientResponse>d__4:MoveNext () (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/HttpClient.cs:84)
    18. System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    19. Unity.Services.Matchmaker.Http.HttpClient/<>c__DisplayClass4_0/<<CreateHttpClientResponse>b__0>d:MoveNext () (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/HttpClient.cs:81)
    20. System.Threading.Tasks.TaskCompletionSource`1<Unity.Services.Matchmaker.Http.HttpClientResponse>:SetResult (Unity.Services.Matchmaker.Http.HttpClientResponse)
    21. Unity.Services.Matchmaker.Http.UnityWebRequestHelpers/<>c__DisplayClass0_0:<GetAwaiter>b__0 (UnityEngine.AsyncOperation) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/UnityWebRequestHelpers.cs:34)
    22. UnityEngine.AsyncOperation:InvokeCompletionEvent ()
    23.  

    Code (CSharp):
    1. HttpException`1: (400) HTTP/1.1 400 Bad Request
    2. Unity.Services.Matchmaker.Http.ResponseHandler.HandleAsyncResponse (Unity.Services.Matchmaker.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/ResponseHandler.cs:122)
    3. Unity.Services.Matchmaker.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Matchmaker.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Http/ResponseHandler.cs:226)
    4. Unity.Services.Matchmaker.Apis.Tickets.TicketsApiClient.CreateTicketAsync (Unity.Services.Matchmaker.Tickets.CreateTicketRequest request, Unity.Services.Matchmaker.Configuration operationConfiguration) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/Apis/TicketsApi.cs:121)
    5. Unity.Services.Matchmaker.WrappedMatchmakerService.TryCatchRequest[TRequest,TReturn] (System.Func`3[T1,T2,TResult] func, TRequest request) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/SDK/WrappedMatchmakerService.cs:228)
    6. Rethrow as MatchmakerServiceException: HTTP/1.1 400 Bad Request
    7. Unity.Services.Matchmaker.WrappedMatchmakerService.ResolveErrorWrapping (Unity.Services.Matchmaker.MatchmakerExceptionReason reason, System.Exception exception) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/SDK/WrappedMatchmakerService.cs:328)
    8. Unity.Services.Matchmaker.WrappedMatchmakerService.TryCatchRequest[TRequest,TReturn] (System.Func`3[T1,T2,TResult] func, TRequest request) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/SDK/WrappedMatchmakerService.cs:251)
    9. Unity.Services.Matchmaker.WrappedMatchmakerService.CreateTicketAsync (System.Collections.Generic.List`1[T] players, Unity.Services.Matchmaker.CreateTicketOptions options) (at Library/PackageCache/com.unity.services.matchmaker@1.0.0-pre.14/Runtime/SDK/WrappedMatchmakerService.cs:55)
    10. Asteroids_Host_Simple.Other.ApplicationController.CreateTicket () (at Assets/Asteroids-Host-Simple/Other/ApplicationController.cs:95)
    11. Asteroids_Host_Simple.Other.ApplicationController.LaunchInMode (System.Boolean isServer, System.String profileName) (at Assets/Asteroids-Host-Simple/Other/ApplicationController.cs:76)
    12. Asteroids_Host_Simple.Other.ApplicationController.Start () (at Assets/Asteroids-Host-Simple/Other/ApplicationController.cs:34)
    13. System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <d6232873609549b8a045fa15811a5bd3>:0)
    14. UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <bae255e3e08e46f7bc2fbd23dde96338>:0)
    15. UnityEngine.UnitySynchronizationContext.Exec () (at <bae255e3e08e46f7bc2fbd23dde96338>:0)
    16. UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <bae255e3e08e46f7bc2fbd23dde96338>:0)
     
  2. DeathPro

    DeathPro

    Joined:
    Jul 28, 2018
    Posts:
    87
    Problem Solved. Here