Re: wrong status line "html" Leads REST API endpoint

Anonymous
Not applicable

wrong status line "html" Leads REST API endpoint

Recently, we've been seeing HTTP "wrong status line" errors when hitting the Leads REST API endpoint. The status line is an expected line in HTTP responses (see section 6.1) that "[consists] of the protocol version followed by a numeric status code..." and looks something like this "HTTP/1.1 200 OK". Effectively, this is just the part of the "header" for an HTTP request. However we're seeing the error wrong status line \"<html>\".

Based on this response, we're guessing one of two things:

1. The expected response content is supposed to be JSON, but this is obviously HTML. This could mean that there's a maintenance HTML page put up instead of a specific "maintenance" JSON response. This usually shouldn't affect the HTTP response headers... but depending on how the configuration is set up for putting up this maintenance page, it could. Additionally supporting this "maintenance" page problem is that these errors happen almost universally around 04:34 UTC (which is 23:34 EST).

2. Potentially, there's a problem with the request we are sending, and the returned response doesn't handle it properly. This seems unlikely as we can see the raw request we are making and it is in line with the Docs for the Marketo Leads endpoint. Also, while the error occurs often, it is still intermittent. This means that its less likely that the request itself is the problem (but not impossible).

If we could have some Marketo developer attention into this issue that would be most welcome. Even if the problem is just maintenance, it will give us an answer and a course of action to resolve these issues.

9 REPLIES 9
Kenny_Elkington
Marketo Employee

Re: wrong status line "html" Leads REST API endpoint

Do you have an example request/response where you're seeing this returned?

Anonymous
Not applicable

Re: wrong status line "html" Leads REST API endpoint

I think I may have found the problem. We specify both the fields we want and then the lead id(s) we wanted. We're using Ruby, and occasionally, instead of passing the filter values for the lead id (e.g. 2) we were sending the encoded Ruby hash like: %23%3CObject%3A0x000000144a9cc0%3E (which is #<Object:0x000000144a9cc0> when decoded)....

So the problem was on our end, but I guess the only thing that could be better is if the API returned a 400 (Bad Request) instead of what I guess is an error page in HTML. That's the only thing I could guess causes the problem, but I can't reproduce it. Doing just one request like:

/rest/v1/leads.json?filterType=id&filterValues=%23%3CObject%3A0x000000144a9cc0%3E

will produce a better and expected response of:

{

"requestId": "a795#156517c2ffd"

"success": false

"errors": {

     "code": "1003"

     "message": "Invalid id '#<Object:0x000000144a9cc0>' specified"

     }

}

But it might have something to do with the number of these hashes that are passed or the size of the GET request.

We only see this error when the GET request to the Leads input is VERY large (i.e. specifying 172 fields, and 250 lead ids*). So maybe it has to do with the length of the GET request? Normally we'd get a more useful error from HTTP when the the GET request is too long (the request wouldn't even be sent in that case).

* which were actually the aforementioned object hashes.

Kenny_Elkington
Marketo Employee

Re: wrong status line "html" Leads REST API endpoint

You'd normally get a 414 if the request URI were too large (over 8k), so if you're getting a 200 and then the bad line, then it would not be that specifically.

SanfordWhiteman
Level 10 - Community Moderator

Re: wrong status line "html" Leads REST API endpoint

I wonder if the error is actually generated by an intermediate device which enforces a (> 8K) path limit but itself has a broken HTTP implementation.

Anonymous
Not applicable

Re: wrong status line "html" Leads REST API endpoint

Sanford Whiteman wrote:

I wonder if the error is actually generated by an intermediate device which enforces a (> 8K) path limit but itself has a broken HTTP implementation.

The problem is that its not technically ​broken​, HTTP section 3.2.1 explicitly says that the HTTP protocol doesn't put any limits on the size of the URI and that its up to the servers to return 414 when the URI is too long for them to handle. The intermediate server is a good theory though. Potentially, if the actual REST API sits behind a general Marketo proxy server, the request is hitting the proxy first and is producing this bad HTTP response when, if it were actually sent through to the REST API, it would produce the correct error. That sounds at least plausible since we all have instance sub domains... A curious problem.

SanfordWhiteman
Level 10 - Community Moderator

Re: wrong status line "html" Leads REST API endpoint

I didn't say the request was broken, I said the HTTPd was broken (i.e. it drops the request and sends back a malformed response).

Anonymous
Not applicable

Re: wrong status line "html" Leads REST API endpoint

I'm not sure that I'm even getting a 200 because the status line is supposed to contain that information. I can't see the raw response because the HTTP client doesn't know what to do with this response and just produces the 'wrong status line \"<html>\" ' error. Maybe the CRLF characters are wrong?

Somehow or another, under certain circumstances the REST API does return HTML (at least the starting tag).

Kenny_Elkington
Marketo Employee

Re: wrong status line "html" Leads REST API endpoint

I know it will under certain circumstances where the path is broken or incomplete and a 403 is returned, but it doesn't seem like you're getting that here.  It would be hard to say unless you can get the raw response from your client

SanfordWhiteman
Level 10 - Community Moderator

Re: wrong status line "html" Leads REST API endpoint

Do you have an inspecting proxy for outbound traffic? This has the ring of something else with a lazy HTTPd generating bad traffic.  Not saying that's what it is for sure, but it rings bells.