503 Errors

503 errors seem very common. I’m not sure if I’m doing something wrong when calling the API or what. But the request normally takes about 60 seconds or so, then I get a 503 error with the title set to “FlightAware is temporarily unavailable”. Most of the time making the request again, works perfectly and I get a response MUCH faster.

Any ideas why this would be occurring? I have considered lowering my timeout considerably and retrying more frequently to speed things up, but I figure that is a bad idea since obviously there is some larger problem here.

Also, am I being charged for these requests that result in an error like this?

There should be no billable queries generated in this scenario.

Was there a specific timeframe or query for when you were observing these results?

It happens pretty consistently on a lot of different queries.

The one log I saved from this happened at Mon, 27 May 2019 03:40:12 GMT.

@dogrock Continues to happen. Here are the details from the latest request that failed:

URL: https://flightxml.flightaware.com/json/FlightXML2/AirlineInfo?airlineCode=UAL
Date: Fri, 31 May 2019 00:08:04 GMT
Status Code: 503

@dogrock I also just got an error while trying to load flightaware.com. This happened right after I got another 503 error.

The Error ID is 131158767. And another Error ID is 131159105.

Are you still seeing error ID’s being thrown at the website after seeing a 503 in XML? I’m not seeing the same errors being logged related to your account during these times. Also, do you happen to be connecting through a proxy service of some kind?

I’ve only ever gotten an error on the website once when loading the website in my web browser. So that seems like a one off thing maybe. I still get errors through FlightXML very often sadly.

I haven’t been posting all the timestamps because of how often the errors occur.

I’m sure at some point I’ve connected through a proxy service and tried to make a request through a VPN during development. But now that I have a staging environment, I’m making a lot of requests from AWS that aren’t through any proxy.

What other information can I provide to you to help debug this further?

The error on Mon, 27 May 2019 03:40:12 GMT didn’t have any error ID’s it doesn’t look like. Other than just returning the status code 503, with a bunch of HTML for the body, the title being “FlightAware is temporarily unavailable”. That error I keep referencing because I saved my error log to a handy text file on my computer. A lot of the errors I’m discarding since they are all identical in terms of the response I’m getting back.

Still happening. Below I have attached a log of the error from my server.

I have obviously changed some minor details (ex. password, etc.) to protect my account.

Hopefully this helps debug further.

{ message: 'Request failed with status code 503',
  status: 503,
  statusText: 'Service Temporarily Unavailable',
  headers:
   { server: 'nginx/1.14.1',
     date: 'Sun, 07 Jul 2019 21:52:46 GMT',
     'content-type': 'text/html',
     'content-length': '4178',
     connection: 'close' },
  config:
   { url: 'https://flightxml.flightaware.com/json/FlightXML2/Search',
     method: 'get',
     params: { query: '-airline JBA' },
     data: '{}',
     headers:
      { Accept: 'application/json, text/plain, */*',
        'Content-Type': 'application/json;charset=utf-8',
        'User-Agent': 'axios/0.19.0',
        'Content-Length': 2 },
     auth:
      { username: 'USERNAME',
        password: 'PASSWORD' },
     baseURL: 'https://flightxml.flightaware.com/json/FlightXML2',
     transformRequest: [ [Function: transformRequest] ],
     transformResponse: [ [Function: transformResponse] ],
     timeout: 0,
     adapter: [Function: httpAdapter],
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus] },
  request:
   ClientRequest {
     domain: null,
     _events:
      [Object: null prototype] {
        socket: [Function],
        abort: [Function],
        aborted: [Function],
        error: [Function],
        timeout: [Function],
        prefinish: [Function: requestOnPrefinish] },
     _eventsCount: 6,
     _maxListeners: undefined,
     output: [],
     outputEncodings: [],
     outputCallbacks: [],
     outputSize: 0,
     writable: true,
     _last: true,
     chunkedEncoding: false,
     shouldKeepAlive: false,
     useChunkedEncodingByDefault: false,
     sendDate: false,
     _removedConnection: false,
     _removedContLen: false,
     _removedTE: false,
     _contentLength: null,
     _hasBody: true,
     _trailer: '',
     finished: true,
     _headerSent: true,
     socket:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: 'flightxml.flightaware.com',
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 8,
        connecting: false,
        _hadError: false,
        _handle: [TLSWrap],
        _parent: null,
        _host: 'flightxml.flightaware.com',
        _readableState: [ReadableState],
        readable: true,
        domain: null,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: [TLSWrap],
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Circular],
        [Symbol(res)]: [TLSWrap],
        [Symbol(asyncId)]: 383,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0,
        [Symbol(connect-options)]: [Object] },
     connection:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: 'flightxml.flightaware.com',
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 8,
        connecting: false,
        _hadError: false,
        _handle: [TLSWrap],
        _parent: null,
        _host: 'flightxml.flightaware.com',
        _readableState: [ReadableState],
        readable: true,
        domain: null,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: [TLSWrap],
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Circular],
        [Symbol(res)]: [TLSWrap],
        [Symbol(asyncId)]: 383,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0,
        [Symbol(connect-options)]: [Object] },
     _header:
      'GET /json/FlightXML2/Search?query=-airline+JBA HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nContent-Type: application/json;charset=utf-8\r\nUser-Agent: axios/0.19.0\r\nContent-Length: 2\r\nHost: flightxml.flightaware.com\r\nAuthorization: Basic TmljZSBhdHRlbXB0IGF0IHRyeWluZyB0byBzdGVhbCBteSBwYXNzd29yZCwgYmV0dGVyIGx1Y2sgbmV4dCB0aW1lLg==\r\nConnection: close\r\n\r\n',
     _onPendingData: [Function: noopPendingOutput],
     agent:
      Agent {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        defaultPort: 443,
        protocol: 'https:',
        options: [Object],
        requests: {},
        sockets: [Object],
        freeSockets: {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        maxCachedSessions: 100,
        _sessionCache: [Object] },
     socketPath: undefined,
     timeout: undefined,
     method: 'GET',
     path: '/json/FlightXML2/Search?query=-airline+JBA',
     _ended: true,
     res:
      IncomingMessage {
        _readableState: [ReadableState],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        socket: [TLSSocket],
        connection: [TLSSocket],
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        httpVersion: '1.1',
        complete: true,
        headers: [Object],
        rawHeaders: [Array],
        trailers: {},
        rawTrailers: [],
        aborted: false,
        upgrade: false,
        url: '',
        method: null,
        statusCode: 503,
        statusMessage: 'Service Temporarily Unavailable',
        client: [TLSSocket],
        _consuming: false,
        _dumped: false,
        req: [Circular],
        responseUrl:
         'https://USERNAME:PASSWORD@flightxml.flightaware.com/json/FlightXML2/Search?query=-airline+JBA',
        redirects: [] },
     aborted: undefined,
     timeoutCb: null,
     upgradeOrConnect: false,
     parser: null,
     maxHeadersCount: null,
     _redirectable:
      Writable {
        _writableState: [WritableState],
        writable: true,
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        _options: [Object],
        _redirectCount: 0,
        _redirects: [],
        _requestBodyLength: 2,
        _requestBodyBuffers: [],
        _onNativeResponse: [Function],
        _currentRequest: [Circular],
        _currentUrl:
         'https://USERNAME:PASSWORD@flightxml.flightaware.com/json/FlightXML2/Search?query=-airline+JBA' },
     [Symbol(isCorked)]: false,
     [Symbol(outHeadersKey)]:
      [Object: null prototype] {
        accept: [Array],
        'content-type': [Array],
        'user-agent': [Array],
        'content-length': [Array],
        host: [Array],
        authorization: [Array] } },
  data:
   '<!DOCTYPE html>\n<html>\n<head>\n\t<title>FlightAware is temporarily unavailable</title>\n\t<meta http-equiv="pragma" content="no-cache" />\n\t<meta http-equiv="refresh" content="120" />\n\n\t<style>\n\t\tbody {\n\t\t\tmargin: 0;\n\t\t}\n\t\t#sitedown-container {\n\t\t\twidth: 728px;\n\t\t\tmargin: 50px auto 20px;\n\t\t\tfont-family: sans-serif, \'Sans Serif\', Arial, Helvetica;\n\t\t}\n\t\t#sitedown-logo img {\n\t\t\tpadding: 10px 25px 10px 0;\n\t\t\tfloat: left;\n\t\t}\n\t\t#sitedown-message {\n\t\t\tfloat: left;\n\t\t\tpadding: 10px 0 10px 25px;\n\t\t\twidth: 515px;\n\t\t\tmargin-bottom: 40px;\n\t\t\tborder-left: 1px solid rgb(221, 221, 221);\n\t\t}\n\t\t#sitedown-message h2 {\n\t\t\tfont-size: 20px;\n\t\t\tmargin: 0 0 0.5em 0;\n\t\t}\n\t\t#sitedown-message p {\n\t\t\tfont-size: 16px;\n\t\t\tmargin: 0;\n\t\t}\n\t\t#sitedown-container > iframe {\n\t\t\tmargin: 20px auto !important;\n\t\t}\n\t\t#sitedown-twitter {\n\t\t\ttext-align: center;\n\t\t}\n\t\t#sitedown-twitter iframe {\n\t\t\twidth: 100%;\n\t\t}\n\t\tfooter {\n\t\t\ttext-align: center;\n\t\t\tcolor: #999;\n\t\t\tfont-size: 10px;\n\t\t}\n\t</style>\n</head>\n<body>\n\t<div style="text-align: right; font-size: 8px">doley</div>\n\t<div id="sitedown-container">\n\t\t<div id="sitedown-logo">\n\t\t\t<img src="http://e0.flightcdn.com/images/logo.png" alt="FlightAware Logo" />\n\t\t</div>\n\n\t\t<div id="sitedown-message">\n\t\t\t<h2>FlightAware is temporarily unavailable</h2>\n\t\t\t<p>We\'re working on restoring service as soon as possible. <em>Expect departure clearance shortly.</em></p>\n\t\t</div>\n\n\t\t<div style="clear: both"></div>\n\n\t\t<iframe id="sitedown-ad1"\n\t\t width="728"\n\t\t height="90"\n\t\t marginwidth="0"\n\t\t marginheight="0"\n\t\t hspace="0"\n\t\t vspace="0"\n\t\t frameborder="0"\n\t\t style="display: block; margin-right: auto; margin-left: auto;"\n\t\t scrolling="no">\n\t\t</iframe>\n\n\t\t<div id="sitedown-twitter">\n\t\t\t<a class="twitter-timeline" href="https://twitter.com/flightaware/lists/outage-updates" data-widget-id="332174758860963840">Follow @FlightAwareOps on Twitter</a>\n\t\t\t<script defer="defer">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>\n\t\t</div>\n\n\t\t<iframe id="sitedown-ad2"\n\t\t width="728"\n\t\t height="90"\n\t\t marginwidth="0"\n\t\t marginheight="0"\n\t\t hspace="0"\n\t\t vspace="0"\n\t\t frameborder="0"\n\t\t style="display: block; margin-right: auto; margin-left: auto;"\n\t\t scrolling="no">\n\t\t</iframe>\n\n\t\t<footer>\n\t\t  &copy; FlightAware\n\t\t</footer>\n\t</div>\n\t<!-- Served by: doley -->\n\n\t<script>\n\t\tvar ad_url = "//ad.doubleclick.net/adi/flight.https;sz=728x90;tile=";\n\t\tdocument.getElementById("sitedown-ad1").src = ad_url + "1;ord=" + getRandomInt(0, 10000000);\n\t\tdocument.getElementById("sitedown-ad2").src = ad_url + "2;ord=" + getRandomInt(0, 10000000);\n\n\t\tfunction getRandomInt(min, max) {\n\t\t\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n\t\t}\n\t</script>\n\n\t<script>\n\tvar lazyload_scripts = [];\n\t_qoptions = { qacct: \'p-16S-sAgkGlgVs\' ,\n\tmeta: \'qc:id=cdbcd5c3aa81f214fa0d2ddd640aa65ed5c19587\' }; lazyload_scripts.push(\'https://edge.quantserve.com/quant.js\');</script>\n\t<noscript><img src=\'https://pixel.quantserve.com/pixel/p-16S-sAgkGlgVs.gif\' style=\'display: none;\' border=\'0\' height=\'1\' width=\'1\' alt=\'\'></noscript>\n\t<script>var _gaq = _gaq || []; _gaq.push([\'_setAccount\', \'UA-498336-1\'], [\'_setVar\', \'US/en_US\'], [\'_initData\'], [\'_trackPageview\', \'/account/ga/logged_in\']); lazyload_scripts.push(\'https://stats.g.doubleclick.net/dc.js\');</script>\n\t<script>var _comscore = [{ c1: \'2\', c2: \'8950477\' }]; lazyload_scripts.push(\'https://sb.scorecardresearch.com/beacon.js\');</script>\n\t<script type=\'text/javascript\' defer=\'defer\'>\n\tfunction lazyLoad() {\n\t\tfor (var x = 0; x < lazyload_scripts.length; x++) {\n\t\t\tvar el = document.createElement(\'script\'); el.type = \'text/javascript\'; el.async = true; el.src = lazyload_scripts[x];\n\t\t\tdocument.getElementsByTagName(\'head\')[0].appendChild(el);\n\t\t}\n\t}\n\tif (typeof window.addEventListener !== \'undefined\') window.addEventListener(\'load\', lazyLoad, false);\n\telse if (typeof window.attachEvent !== \'undefined\') window.attachEvent(\'onload\', lazyLoad);\n\telse lazyLoad();\n\t</script>\n</body>\n</html>\n' }

I think I was able to fix this. I realized I was sending an empty object as the body for a GET request. Didn’t even realize that was possible. But removing that line from my code and not ending any body seems to be working correctly now.

Might be a good idea if FlightAware fixed this on their end to handle bad input like this. cc/ @dogrock