locked
500 error when response body is empty RRS feed

  • Question

  • As of Dec 15, we started seeing the gateway generate 500 errors when accessing the context.Response.Body for empty responses. As part of a log to event hub we grab the body. On some failed calls, 401, that returned no body, we started seeing this exception popup up. It worked fine in the past, just started at 2pm on the 15th. We didnt update any downstream services, after some work we tracked it down to the logging code. Below is a snippet of how we are getting the body.

    var body = context.Response.Body?.As<string>(true);
                          if (body != null && body.Length > 1024)
                          {
                              body = body.Substring(0, 1024);
                          }

    The context.Response.Body?.As<string>(true) line is the once that dies.

    We tried doing if(context.Response.Body !=null)  and even if (context.Response != null) and so forth but it would always fail anytime we touched that Body object.

    Anyone have any ideas or seen similar activity recently? thanks.

    Friday, December 16, 2016 7:13 PM

Answers

  • Confirmed it's a bug in the last release and we are working on a fix. If this is urgent for you, please send me your APIM instance name and we'll try to get it fixed asap. You can reach me at mijiang at Microsoft dotcom.
    • Proposed as answer by Swikruti Bose Tuesday, January 17, 2017 10:09 AM
    • Marked as answer by Sjoukje ZaalMVP Thursday, February 23, 2017 11:57 AM
    Wednesday, January 4, 2017 9:18 PM
  • Deleted
    • Proposed as answer by Swikruti Bose Tuesday, January 17, 2017 10:09 AM
    • Marked as answer by Sjoukje ZaalMVP Thursday, February 23, 2017 11:57 AM
    Thursday, January 5, 2017 11:21 AM

All replies

  • Hello,

    We are checking on the query and would get back to you soon on this.

    Apologize for the inconvenience and appreciate your time and patience in this matter.

    Regards,


    • Edited by Sheethal J S Saturday, December 17, 2016 6:14 AM
    Saturday, December 17, 2016 6:14 AM
  • Hi,

     

    Thanks for posting here.

     

    There was an outage in the service. We are working on this and it will get resolved at the earliest.

     

    Regards,

    Wednesday, December 21, 2016 10:55 AM
  • Has there been any discover on this issue?  I see the issue on any call where the response body is empty.
    Tuesday, January 3, 2017 4:20 PM
  • We have seen this exact same thing and is impacting some production API calls.  Extremely interested in getting a fix.
    Wednesday, January 4, 2017 3:27 PM
  • Confirmed it's a bug in the last release and we are working on a fix. If this is urgent for you, please send me your APIM instance name and we'll try to get it fixed asap. You can reach me at mijiang at Microsoft dotcom.
    • Proposed as answer by Swikruti Bose Tuesday, January 17, 2017 10:09 AM
    • Marked as answer by Sjoukje ZaalMVP Thursday, February 23, 2017 11:57 AM
    Wednesday, January 4, 2017 9:18 PM