Something wrong with my Message Server

When an order is posted to the Message Server via gql, it returns

"errors": [
    {
      "locations": [
        {
          "line": 0,
          "column": 0
        }
      ],
      "message": "Error trying to resolve addTicket.",

However, if another order immediately posts the the MS (within like 10 seconds), it gives no error.

{
  "data": {
    "addTicket": {
      "id": 966734
    }
  },
  "errors": null
}

Here’s the console log of the GF integration. Two orders come in at approximately the same time. The first one doesn’t go through, but the second one goes through.

Reading Tickets...
Reading Tickets...
Reading Tickets...
Reading Tickets...

        mutation m{addTicket(
            ticket:{type:"Delivery Ticket",
                department:"Delivery",
                user:"Administrator",
                terminal:"Server",
                note:"No napkinsBuzzer is 104NO CONTACT DELIVERY",
                entities:[{entityType:"Customers",name:"redacted"}],
                states:[
                    {stateName:"Status",state:"New Orders"},
                    {stateName:"Source",state:"GloriaFood Delivery Prepaid"},
                    {stateName:"Payment",state:"ONLINE"},
                                        {stateName:"Delivery",state:"Waiting"},
                                        {stateName:"OnlineType",state:"delivery"}
                ],
                tags:[
                                        {tagName:"Delivery Minutes",tag:"44"},
                                        {tagName:"Paid",tag:"GloriaFood Paid"},
                                        {tagName:"Delivery Tip",tag:"3.84"},
                                        {tagName:"DeliveryAddress",tag:"redacted"}
                                ],
                calculations:[],
                orders:[{
            name:"Tuna Salad",
            menuItemName:"",
            quantity:1,
            portion:"Hero",
            price:7,
            tags:[{tagName:"Vegetables",tag:"Tomato",price:0.4,quantity:1},{tagName:"Vegetables",tag:"Cucumber",price:0.4,quantity:1},{tagName:"Dressings",tag:"Mustard",price:0,quantity:1}],
            states:[
                {stateName:"Status",state:"New"},{stateName:"KDOrderStatus",state:"KDFNewDelivery"}
            ]
        },{
            name:"Kettle Chips Hal's BBQ 2 oz",
            menuItemName:"",
            quantity:1,
            
            
            tags:[],
            states:[
                {stateName:"Status",state:"New"}
            ]
        },{
            name:"Iced Coffee",
            menuItemName:"",
            quantity:1,
            portion:"Medium",
            price:3.55,
            tags:[{tagName:"Coffee Milk",tag:"Oatmilk",price:0.5,quantity:1},{tagName:"Sweetener",tag:"Sugar",price:0,quantity:1}],
            states:[
                {stateName:"Status",state:"New"}
            ]
        }]
            }){id}}
{ addTicket: null }
Reading Tickets...

        mutation m{addTicket(
            ticket:{type:"Delivery Ticket",
                department:"Delivery",
                user:"Administrator",
                terminal:"Server",
                note:"NO CONTACT DELIVERY",
                entities:[{entityType:"Customers",name:"redacted"}],
                states:[
                    {stateName:"Status",state:"New Orders"},
                    {stateName:"Source",state:"GloriaFood Delivery Prepaid"},
                    {stateName:"Payment",state:"ONLINE"},
                                        {stateName:"Delivery",state:"Waiting"},
                                        {stateName:"OnlineType",state:"delivery"}
                ],
                tags:[
                                        {tagName:"Delivery Minutes",tag:"45"},
                                        {tagName:"Paid",tag:"GloriaFood Paid"},
                                        {tagName:"Delivery Tip",tag:"2.62"},
                                        {tagName:"DeliveryAddress",tag:"redacted"}
                                ],
                calculations:[],
                orders:[{
            name:"Eggs (No Meat)",
            menuItemName:"",
            quantity:1,
            portion:"Roll",
            price:3.75,
            tags:[{tagName:"Roll Type",tag:"Toasted Plain Roll",price:0,quantity:1},{tagName:"Egg Style",tag:"Scrambled",price:0,quantity:1},{tagName:"Cheese",tag:"Provolone Cheese",price:0.7,quantity:1},{tagName:"Vegetables",tag:"Grilled Mushroom",price:0.85,quantity:1},{tagName:"Dressings",tag:"Chipotle Mayo",price:0,quantity:1}],
            states:[
                {stateName:"Status",state:"New"},{stateName:"KDOrderStatus",state:"KDFNewDelivery"}
            ]
        },{
            name:"PB&B Smoothie",
            menuItemName:"",
            quantity:1,
            
            
            tags:[{tagName:"Milk Substitutions 1",tag:"Use Almondmilk",price:0,quantity:1},{tagName:"Comment",tag:"Instructions",note:"Not too sweet if possible"}],
            states:[
                {stateName:"Status",state:"New"}
            ]
        }]
            }){id}}
{ addTicket: { id: 966732 } }
Reading Tickets...
Reading Tickets...
Reading Tickets...

Is my Message Server sleeping or something?

1 Like

Example:
I post this:

Then seconds later, I repost the EXACT same mutation and it goes through without problems.

Another Example:

Full error message

{
  "data": {
    "addTicket": null
  },
  "errors": [
    {
      "locations": [
        {
          "line": 0,
          "column": 0
        }
      ],
      "message": "Error trying to resolve addTicket.",
      "data": {},
      "innerException": {
        "NativeErrorCode": 0,
        "ClassName": "System.ComponentModel.Win32Exception",
        "Message": "The operation completed successfully",
        "Data": null,
        "InnerException": null,
        "HelpURL": null,
        "StackTraceString": "   at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)\r\n   at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)\r\n   at System.Windows.Threading.Dispatcher..ctor()\r\n   at System.Windows.Threading.Dispatcher.get_CurrentDispatcher()\r\n   at Samba.Services.Implementations.AutomationModule.ActionDataBuilder.InvokeWith(AppState appState, RuleExecutionContext context) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Implementations\\AutomationModule\\ActionDataBuilder.cs:line 84\r\n   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWithoutLogging(Object ruleData) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Implementations\\AutomationModule\\RuleExecutor.cs:line 125\r\n   at Samba.Services.Implementations.AutomationModule.NotificationService.NotifyEvent(String eventName, Object dataParameter, AppState appState) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Implementations\\AutomationModule\\NotificationService.cs:line 26\r\n   at Samba.Services.Implementations.TicketModule.TicketServiceBase.CreateTicket(AppState appState) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Implementations\\TicketModule\\TicketServiceBase.cs:line 97\r\n   at Samba.Services.Graphql.Builders.GraphTicketBuilder.CreateTicketFromTicketInput(TicketInput ticketInput) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Graphql\\Builders\\GraphTicketBuilder.cs:line 42\r\n   at Samba.Services.Graphql.Tickets.TicketMutation.AddTicket(ResolveFieldContext context) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Graphql\\Tickets\\TicketMutation.cs:line 826\r\n   at GraphQL.DocumentExecuter.<ResolveFieldAsync>d__8.MoveNext()",
        "RemoteStackTraceString": null,
        "RemoteStackIndex": 0,
        "ExceptionMethod": "8\nRegisterClassEx\nWindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\nMS.Win32.UnsafeNativeMethods\nUInt16 RegisterClassEx(WNDCLASSEX_D)",
        "HResult": -2147467259,
        "Source": "WindowsBase",
        "WatsonBuckets": null
      },
      "stackTrace": null,
      "helpLink": null,
      "source": null,
      "hResult": -2146233088
    }
  ]
}

So you are adding a ticket and not using a terminal?

It could be your sql server settings causing the connection to close after inactivity

You can try keeping the connection live. Registering a terminal would solve that though. Let me find the setting to show you.

In MSSMS right click your database choose properties then go to Options and make sure Auto Close is False

Yep :rofl:

I think I fixed it by restarting the Message Server service.
I wish I knew what caused the hiccup…

Fixed: solution was restarting the Message Server.