azure-signalr: Missing required property 'type'

We are regularly receiving the following error in our logs. Several times a second.

Error when processing requests.

System.IO.InvalidDataException: Missing required property 'type'.
   at HubMessage Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.ParseMessage(Utf8BufferTextReader textReader, IInvocationBinder binder)
   at bool Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.TryParseMessage(ref ReadOnlySequence<byte> input, IInvocationBinder binder, out HubMessage message)
   at async Task Microsoft.AspNetCore.SignalR.HubConnectionHandler<THub>.DispatchMessagesAsync(HubConnectionContext connection)
   at async Task Microsoft.AspNetCore.SignalR.HubConnectionHandler<THub>.RunHubAsync(HubConnectionContext connection)

I’m not positive, but it seems like it has to do with the Azure SignalR Service because as far as I can tell, all clients are including the ‘type’ property in all JSON messages. We are only seeing this in one of our subscriptions/environments.

Versions: JS client: 1.1.0 Microsoft.AspNetCore.SignalR: 1.1.0 Microsoft.Azure.SignalR: 1.0.6

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Here you are. I am not sure this all lines relate to the error. I collected some of them before and some after.

{"@timestamp":"2020-05-25T09:12:24.8058208+00:00","level":"Debug","messageTemplate":"Message received. Type: {MessageType}, size: {Count}, EndOfMessage: {EndOfMessage}.","message":"Message received. Type: Binary, size: 3086, EndOfMessage: True.","MessageType":"Binary","Count":3086,"EndOfMessage":true,"EventId":{"Id":12,"Name":"MessageReceived"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8059330+00:00","level":"Debug","messageTemplate":"Received {ReceivedBytes} bytes from service {ServiceConnectionId}.","message":"Received 3086 bytes from service \"8c71ad72-3229-4d81-b4ea-a8392f8c281b\".","ReceivedBytes":3086,"ServiceConnectionId":"8c71ad72-3229-4d81-b4ea-a8392f8c281b","EventId":{"Id":16,"Name":"ReceivedMessage"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8061323+00:00","level":"Debug","messageTemplate":"Connection {TransportConnectionId} started.","message":"Connection \"eeUqL4j35RvfLRbZ4Z7S4Ad63a888a1\" started.","TransportConnectionId":"eeUqL4j35RvfLRbZ4Z7S4Ad63a888a1","EventId":{"Id":11,"Name":"ConnectedStarting"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8062966+00:00","level":"Debug","messageTemplate":"Received message from application. Payload size: {Count}.","message":"Received message from application. Payload size: 40.","Count":40,"EventId":{"Id":13,"Name":"ReceivedFromApp"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8063680+00:00","level":"Debug","messageTemplate":"Received message from application. Payload size: {Count}.","message":"Received message from application. Payload size: 70.","Count":70,"EventId":{"Id":13,"Name":"ReceivedFromApp"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8112394+00:00","level":"Debug","messageTemplate":"Message received. Type: {MessageType}, size: {Count}, EndOfMessage: {EndOfMessage}.","message":"Message received. Type: Binary, size: 6, EndOfMessage: True.","MessageType":"Binary","Count":6,"EndOfMessage":true,"EventId":{"Id":12,"Name":"MessageReceived"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8113530+00:00","level":"Debug","messageTemplate":"Received {ReceivedBytes} bytes from service {ServiceConnectionId}.","message":"Received 6 bytes from service \"8c71ad72-3229-4d81-b4ea-a8392f8c281b\".","ReceivedBytes":6,"ServiceConnectionId":"8c71ad72-3229-4d81-b4ea-a8392f8c281b","EventId":{"Id":16,"Name":"ReceivedMessage"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8114689+00:00","level":"Debug","messageTemplate":"Received message from application. Payload size: {Count}.","message":"Received message from application. Payload size: 70.","Count":70,"EventId":{"Id":13,"Name":"ReceivedFromApp"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8166092+00:00","level":"Debug","messageTemplate":"Message received. Type: {MessageType}, size: {Count}, EndOfMessage: {EndOfMessage}.","message":"Message received. Type: Binary, size: 6, EndOfMessage: True.","MessageType":"Binary","Count":6,"EndOfMessage":true,"EventId":{"Id":12,"Name":"MessageReceived"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8167182+00:00","level":"Debug","messageTemplate":"Received {ReceivedBytes} bytes from service {ServiceConnectionId}.","message":"Received 6 bytes from service \"8c71ad72-3229-4d81-b4ea-a8392f8c281b\".","ReceivedBytes":6,"ServiceConnectionId":"8c71ad72-3229-4d81-b4ea-a8392f8c281b","EventId":{"Id":16,"Name":"ReceivedMessage"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.8269787+00:00","level":"Debug","messageTemplate":"Received message from application. Payload size: {Count}.","message":"Received message from application. Payload size: 97.","Count":97,"EventId":{"Id":13,"Name":"ReceivedFromApp"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9095066+00:00","level":"Debug","messageTemplate":"Message received. Type: {MessageType}, size: {Count}, EndOfMessage: {EndOfMessage}.","message":"Message received. Type: Binary, size: 69, EndOfMessage: True.","MessageType":"Binary","Count":69,"EndOfMessage":true,"EventId":{"Id":12,"Name":"MessageReceived"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9096301+00:00","level":"Debug","messageTemplate":"Received {ReceivedBytes} bytes from service {ServiceConnectionId}.","message":"Received 69 bytes from service \"8c71ad72-3229-4d81-b4ea-a8392f8c281b\".","ReceivedBytes":69,"ServiceConnectionId":"8c71ad72-3229-4d81-b4ea-a8392f8c281b","EventId":{"Id":16,"Name":"ReceivedMessage"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}

{"@timestamp":"2020-05-25T09:12:24.9102736+00:00","level":"Error","messageTemplate":"Error when processing requests.","message":"Error when processing requests.","exception":{"Depth":0,"ClassName":"System.IO.InvalidDataException","Message":"Missing required property 'type'.","Source":"Microsoft.AspNetCore.SignalR.Protocols.Json","StackTraceString":"   at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.ParseMessage(Utf8BufferTextReader textReader, IInvocationBinder binder)\r\n   at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.TryParseMessage(ReadOnlySequence`1& input, IInvocationBinder binder, HubMessage& message)\r\n   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.DispatchMessagesAsync(HubConnectionContext connection)\r\n   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)","RemoteStackTraceString":null,"RemoteStackIndex":0,"HResult":-2146233087,"HelpURL":null},"EventId":{"Id":2,"Name":"ErrorProcessingRequest"},"SourceContext":"Microsoft.AspNetCore.SignalR.HubConnectionHandler","ExceptionDetail":{"Type":"System.IO.InvalidDataException","HResult":-2146233087,"Message":"Missing required property 'type'.","Source":"Microsoft.AspNetCore.SignalR.Protocols.Json"},"MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}

{"@timestamp":"2020-05-25T09:12:24.9123818+00:00","level":"Debug","messageTemplate":"Received message from application. Payload size: {Count}.","message":"Received message from application. Payload size: 148.","Count":148,"EventId":{"Id":13,"Name":"ReceivedFromApp"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9123901+00:00","level":"Debug","messageTemplate":"Waiting for the transport layer to end.","message":"Waiting for the transport layer to end.","EventId":{"Id":2,"Name":"WaitingForTransport"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9256424+00:00","level":"Debug","messageTemplate":"Received message from application. Payload size: {Count}.","message":"Received message from application. Payload size: 37.","Count":37,"EventId":{"Id":13,"Name":"ReceivedFromApp"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9257374+00:00","level":"Debug","messageTemplate":"Sending close connection message to the service for {TransportConnectionId}.","message":"Sending close connection message to the service for \"eeUqL4j35RvfLRbZ4Z7S4Ad63a888a1\".","TransportConnectionId":"eeUqL4j35RvfLRbZ4Z7S4Ad63a888a1","EventId":{"Id":13,"Name":"CloseConnection"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9257555+00:00","level":"Debug","messageTemplate":"Connection {TransportConnectionId} ended.","message":"Connection \"eeUqL4j35RvfLRbZ4Z7S4Ad63a888a1\" ended.","TransportConnectionId":"eeUqL4j35RvfLRbZ4Z7S4Ad63a888a1","EventId":{"Id":12,"Name":"ConnectedEnding"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9283635+00:00","level":"Debug","messageTemplate":"Message received. Type: {MessageType}, size: {Count}, EndOfMessage: {EndOfMessage}.","message":"Message received. Type: Binary, size: 37, EndOfMessage: True.","MessageType":"Binary","Count":37,"EndOfMessage":true,"EventId":{"Id":12,"Name":"MessageReceived"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:24.9284522+00:00","level":"Debug","messageTemplate":"Received {ReceivedBytes} bytes from service {ServiceConnectionId}.","message":"Received 37 bytes from service \"8c71ad72-3229-4d81-b4ea-a8392f8c281b\".","ReceivedBytes":37,"ServiceConnectionId":"8c71ad72-3229-4d81-b4ea-a8392f8c281b","EventId":{"Id":16,"Name":"ReceivedMessage"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:25.1063772+00:00","level":"Debug","messageTemplate":"Message received. Type: {MessageType}, size: {Count}, EndOfMessage: {EndOfMessage}.","message":"Message received. Type: Binary, size: 48, EndOfMessage: True.","MessageType":"Binary","Count":48,"EndOfMessage":true,"EventId":{"Id":12,"Name":"MessageReceived"},"SourceContext":"Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}
{"@timestamp":"2020-05-25T09:12:25.1064909+00:00","level":"Debug","messageTemplate":"Received {ReceivedBytes} bytes from service {ServiceConnectionId}.","message":"Received 48 bytes from service \"25059cd1-5ca0-47a9-a274-14cf78177b2a\".","ReceivedBytes":48,"ServiceConnectionId":"25059cd1-5ca0-47a9-a274-14cf78177b2a","EventId":{"Id":16,"Name":"ReceivedMessage"},"SourceContext":"Microsoft.Azure.SignalR.ServiceConnection","MachineName":"we-iis-dc-2","assemblyVersion":"348.1570.0.0","environment":"prod","serviceName":"deliverycashier"}

We have the same issue. From time to time I see in logs the same error with stacktrace.

Versions: Android client: com.microsoft.signalr:signalr: 3.1.0 Microsoft.AspNetCore.SignalR: 1.1.0 Microsoft.Azure.SignalR: 1.4.3

We have now not so many clients (avg 10 simultaneous connections) but we got about 50 such errors per day.

I am not sure if your actual issue is a similar one, but in one of my projects we received the error as well.

The reason was this: When hosting on Azure, we forgot to activate WebSockets for the Azure App Service. This was Problem part 1. This lead to SignalR trying to fall back to Long Polling, which lead to problem part 2: We also had a misconfigured Service Worker active, which cached and disrupted SignalR traffic, leading to the “type” property missing exceptions.

Hopefully this can help anyone else encountering this problem.