Heello / Issues

Bug and feature tracking
1 stars 0 forks source link

API - HTTP DELETE routes returning HTTP 411 #24

Closed katanacrimson closed 11 years ago

katanacrimson commented 11 years ago

Just started getting this on several routes.

  1) node-heello Authenticated REST API - checkins endpoints - POST /checkins.json (heello.checkins.create):
     Error: got 411 response

411 is supposed to mean "missing content-length", however nothing within my libs or dependency stack has changed.

This seems to affect all DELETE operations.

1) POST /checkins.json (heello.checkins.create)
2) DELETE /pings/:id.json (heello.pings.destroy) - OWN PING
3) DELETE /pings/:id.json (heello.pings.destroy) - ECHOED PING

Note: the heello.checkins.create test uses a DELETE afterwards to clean up after itself

Additionally, the "example place" on the docs for places.show is resulting in an HTTP 404 error.

caseym commented 11 years ago

I will look into this. We had some issues yesterday and this could be related. I will post back when they're resolved.

katanacrimson commented 11 years ago

Thanks much for the turnaround.

liclac commented 11 years ago

May I suggest you make an API Status page, similar to the one Twitter has, with sanity checks for each API endpoint? That would be sure to help debugging.

caseym commented 11 years ago

@uppfinnarn thanks for the suggestion. I think that would be useful too.

caseym commented 11 years ago

@damianb has the 411 response on deletes been resolved? I show it working correctly again.

curl -i -d "access_token=OMITTED" -X DELETE "https://api.heello.com/pings/11554444.json" HTTP/1.1 200 OK Cache-Control: max-age=0, private, must-revalidate Content-Type: application/json; charset=utf-8 Date: Tue, 11 Jun 2013 15:31:12 GMT ETag: "7215ee9c7d9dc229d2921a40e899ec5f" Server: nginx/1.2.4 Set-Cookie: makara-force-master=master; expires=Tue, 11-Jun-2013 15:31:17 GMT Status: 200 OK X-Rack-Cache: invalidate, pass X-RateLimit-Limit: 8400 X-RateLimit-Remaining: 8294 X-Request-Id: 7c1cc496b150f3262df846a3f46a973b X-Runtime: 0.055993 X-UA-Compatible: IE=Edge,chrome=1 Content-Length: 1 Connection: keep-alive

katanacrimson commented 11 years ago

Negative. Unit tests still showing HTTP 411. Hold on while I grab some raw HTTP data.

katanacrimson commented 11 years ago

Odd. Something's injecting the header Transfer-Encoding on me. Trying to monkey-patch.

katanacrimson commented 11 years ago

https://github.com/mikeal/request/pull/41

This seems oddly relevant... (chunk out of req)

{
     method: 'DELETE',
     path: '/pings/11556650.json?access_token=REDACTED',
     _headers:
      { host: 'api.heello.com',
        'accept-encoding': 'gzip, deflate',
        accept: 'application/vnd.heello.v1',
        'user-agent': 'node-heello_v1.0.3' },
     _headerNames:
      { host: 'Host',
        'accept-encoding': 'Accept-Encoding',
        accept: 'Accept',
        'user-agent': 'User-Agent' },
     _header: 'DELETE /pings/11556650.json?access_token=REDACTED HTTP/1.1\r\nHost: api.heello.com\r\nAccept-Encoding: gzip, deflate\r\nAccept: application/vnd.heello.v1\r\nUser-Agent:node-heello_v1.0.3\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n',
     _headerSent: true,
}

I'll go nag upstream, I guess.

ed: https://github.com/visionmedia/superagent/issues/236

katanacrimson commented 11 years ago

As per above comment, this is an issue I've poked upstream about for my library, related to nginx pickiness about HTTP DELETE queries. I've got a workaround here that should work for now.

My other failing tests though are of a different manner. First, I'm seeing the ping search test resulting in 404 not found (even on the developer website) for "api" while different words are completely fine.

The following is a snip from the req object dump:

_header: 'GET /pings/search.json?query=api&key=REDACTED HTTP/1.1\r\nHost: api.heello.com\r\nAccept-Encoding: gzip, deflate\r\nAccept: application/vnd.heello.v1\r\nUser-Agent: node-heello_v1.0.3\r\nConnection: keep-alive\r\n\r\n',

...which results in a 404.

The other failing test is this one, which uses one of the example location GUIDs provided on the Heello API docs.

            heello.places.show({ id: '322-0cab6928-e62b-4d48-a005-5199c61264d3' }, function(err, json, res) {
                assert.ifError(err, 'request error')
                assert.equal(typeof json.response, "object", 'response should be an object')
                done()
            })

It too is giving a 404 response now, which is a problem; we need clean example data to work with for test cases, and if that data's being deleted or blocked, that's not helpful.

katanacrimson commented 11 years ago

Minor update: GET/pings/search is 404'ing on "api", "test". Unknown if there are others. Are you guys blacklisting common terms or something?