1

I am currently using Swagger UI version 3.19.0 with Flask-RestPlus version 0.13.0 and testing out unauthorised (401) response of uploading file endpoint of my deployed python flask application on Chrome. The problem is that I am getting TypeError: Failed to fetch with error net::ERR_HTTP2_PROTOCOL_ERROR instead of 401 responses. I can see from my server logs that my backend is returning correct 401 responses. I am using gunicorn gateway with keep-alive set to true and uploading zip file with size > 64KB. The swagger ui is working fine for all other endpoints receiving correct responses from the server. Surprisingly, I tested the same file upload endpoint on Firefox browser and it has no problem returning correct 401 responses. It seems that this TypeError only occurs on chrome browser.

[Update] I investigated further into the chrome-net-export-log.json file and found out the below logs. It seems that while the browser is sending the zip file and when it counters upload stream reset due to unauthorised request, it is not receiving the incoming unauthorised response and just throw ERR_HTTP2_PROTOCOL_ERROR

          HTTP2_STREAM_UPDATE_SEND_WINDOW
                          --> delta = -13505
                          --> stream_id = 23
                          --> window_size = 105
          UPLOAD_DATA_STREAM_READ  [dt=0]
                          --> current_position = 1875012
          HTTP2_STREAM_UPDATE_SEND_WINDOW
                          --> delta = -154
                          --> stream_id = 23
                          --> window_size = 0
          HTTP2_STREAM_UPDATE_RECV_WINDOW
                          --> delta = -32
                          --> stream_id = 23
                          --> window_size = 6314596
          HTTP2_STREAM_ERROR
                          --> description = "Server reset stream."
                          --> net_error = "ERR_HTTP2_PROTOCOL_ERROR"
                          --> stream_id = 23
       -HTTP_TRANSACTION_SEND_REQUEST
                        --> net_error = -337 (ERR_HTTP2_PROTOCOL_ERROR)
     -URL_REQUEST_START_JOB
                      --> net_error = -337 (ERR_HTTP2_PROTOCOL_ERROR)
      URL_REQUEST_DELEGATE_RESPONSE_STARTED  [dt=0]
 -CORS_REQUEST
 -URL_REQUEST_DELEGATE_RESPONSE_STARTED
 -REQUEST_ALIVE
                  --> net_error = -337 (ERR_HTTP2_PROTOCOL_ERROR)

May i have suggestions and solutions for this problem and Thank you in advance.

Min
  • 11
  • 2
  • What's the error message in the Console tab in Chrome dev tools? – Helen Sep 09 '22 at 06:33
  • Hello! the error message in the Console tab in Chrome dev said "POST https://my-end-point/file-upload net::ERR_HTTP2_PROTOCOL_ERROR". I tried debugging on chrome and it happens at line 17573 of swagger-ui-bundle.js after formatting that js file. – Min Sep 09 '22 at 07:21
  • Check out [What's the net::ERR_HTTP2_PROTOCOL_ERROR about?](https://stackoverflow.com/q/58215104/113116) and see if any of the suggestions there help. – Helen Sep 09 '22 at 09:25
  • Thanks for sharing the link. I tried with relevant solutions under that post but still the error doesn't go away. I dug deeper into the chrome-net-export-log.json file and update the post with what i found. – Min Sep 12 '22 at 08:55

0 Answers0