Help

Re: HTTP error 504 response not in JSON format

6679 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Tuur
10 - Mercury
10 - Mercury

As far as I can tell I aways get nice JSON responses, but with this error the response comes in the form of a HTML page. My error handling didn’t like that.

<!DOCTYPE html>
<html>
<head>
etc
<h1 class="my2">This page is taking too long to load.</h1>

Is this intentional?

14 Replies 14
Alexander_Sorok
6 - Interface Innovator
6 - Interface Innovator

Hi Tuur,

No, it shouldn’t be like that. What client language/library are you using? Do you have the headers that you are sending? What’s in the content-type and accept headers?

Alex

The hard part is that it almost never happens of course, so it’s difficult to reproduce.

I’ll be back when I have more…

Alexander_Sorok
6 - Interface Innovator
6 - Interface Innovator

What are those headers for regular requests?

Alex

Generally Authorization & Content-Type (application/json) for Post / Patch (HTTP 1.1).

The reason I was asking is that I have a feeling it is related to attachments / photos fields and server-side time-outs only. So I was figuring it might have been some sort of internal error forwarding that’s not converted or something.

But the problem might just as well be me too of course. :slightly_smiling_face:

Anyway, I’ve added the Accept (application/json) now too. I’ll be back…

Tuur
10 - Mercury
10 - Mercury

So rethinking about this all; you probably take my content type header for post & patch as the default for your response and since that hint is missing for the other requests (specifically ‘get’) I get HTML?

Yeah, that’s probably it. We only look at content-type and if it’s not set, you’d get HTML. GET requests may or may not include content-type as it should be sending no content. There was a recent patch for that to airtable.js.

I think we’ll need to change it to just never return HTML for api.airtable.com. Our API always returns JSON anyway.

I was lazily assuming that. And never noticed until I got timed out (which almost never happens).

Anyway, learned a couple of new things. Thanks for the help!

After adding the Accept header (to application/json) I’m still getting HTML with 504’s & 502’s. The weird thing is that sometimes the 502’s come in JSON. I’ve already double checked my code, but I’m pretty sure my calls are consistent.

Since these are both time-out errors could it be something in the processing (order?) on your side or can I try other headers / combinations?

<h1 class="my2">This page is taking too long to load.</h1>
<h3 class="quiet">Sorry about that. Please try refreshing and contact us if the problem persists.</h3>