2

After deploying a blazor server side project to an Amazon Web Services environment via AWS Elastic Beanstalk, the website experiences frequent disconnects that I do not understand.

These disconnects do not happen locally when testing.

Errors:

[2020-04-30T16:29:18.326Z] Error: Connection disconnected with error 'Error'.

and

Failed to load resource: the server responded with a status of 504 ()

The request causing the 504 errors has a header like so:

Request URL: https://mywebserver/_blazor?id=UOPQELxzuEcaGbpNUQA01Q&_=1588264098305
Request Method: GET
Status Code: 504 
Remote Address: 3.11.236.203:443
Referrer Policy: no-referrer-when-downgrade
content-length: 550
content-type: text/html
date: Thu, 30 Apr 2020 16:29:20 GMT
server: awselb/2.0
status: 504
:authority: mywebserver
:method: GET
:path: /_blazor?id=UOPQELxzuEcaGbpNUQA01Q&_=1588264098305
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-GB,en-US;q=0.9,en;q=0.8
content-type: text/plain;charset=UTF-8
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
x-requested-with: XMLHttpRequest

This issue seems remarkably similar to a Github issue posted here, that is currently being investigated by Microsoft, although this issue is not AWS-related: https://github.com/dotnet/aspnetcore/issues/19094

Any help would be vastly appreciated!

mb1231
  • 308
  • 3
  • 16
  • Looks a lot like the issue you found. Maybe, indeed something I'd going wrong with the SignalR hub. Perhaps disabling websockets can solve this - blazor would then run over XHR requests. Which is slow, though, so maybe the webassembly flavor world be a good fit for your app – rdmptn May 01 '20 at 11:55

1 Answers1

1

i managed to fix this in the end.

Apparently the issue was caused by the use of LongPolling. LongPolling issues requests and waits 100 seconds before cancelling the request. By setting the timeout to be greater than the default of 60 seconds in the Elastic Load Balancer in my AWS settings, the disconnects stopped. 110 seconds was recommended as a safe timeout value.

Issue on Asp.NET github that I opened for those interested: https://github.com/dotnet/aspnetcore/issues/21369

mb1231
  • 308
  • 3
  • 16