Hi, I have got some Node JS code to fetch GTFS realtime vehicle position feeds from ferries, trains, buses and light rails. It is working fine but sometimes I get this seemingly random “statusCode”:401 errors in the returned response, but next time the returned results fixes itself up and become OK. I fetch the realtime feeds every 15 seconds. Is it because the authentication takes too long to respond?
An example of such error in JSON is:
{"statusCode":401,"body":{"0":123,"1":32,"2":34,"3":69,"4":114,"5":114,"6":111,"7":114,"8":68,"9":101,"10":116,"11":97,"12":105,"13":108,"14":115,"15":34,"16":58,"17":32,"18":123,"19":32,"20":34,"21":84,"22":114,"23":97,"24":110,"25":115,"26":97,"27":99,"28":116,"29":105,"30":111,"31":110,"32":73,"33":100,"34":34,"35":58,"36":34,"37":48,"38":48,"39":48,"40":48,"41":48,"42":49,"43":53,"44":53,"45":52,"46":54,"47":49,"48":102,"49":57,"50":51,"51":49,"52":53,"53":45,"54":51,"55":98,"56":49,"57":53,"58":48,"59":98,"60":52,"61":34,"62":44,"63":32,"64":34,"65":69,"66":114,"67":114,"68":111,"69":114,"70":68,"71":97,"72":116,"73":101,"74":84,"75":105,"76":109,"77":101,"78":34,"79":58,"80":34,"81":50,"82":48,"83":49,"84":54,"85":45,"86":49,"87":49,"88":45,"89":48,"90":50,"91":84,"92":49,"93":53,"94":58,"95":51,"96":57,"97":58,"98":52,"99":57,"100":46,"101":48,"102":52,"103":48,"104":43,"105":49,"106":49,"107":58,"108":48,"109":48,"110":34,"111":44,"112":32,"113":34,"114":77,"115":101,"116":115,"117":115,"118":97,"119":103,"120":101,"121":34,"122":58,"123":34,"124":67,"125":97,"126":108,"127":108,"128":105,"129":110,"130":103,"131":32,"132":97,"133":112,"134":112,"135":108,"136":105,"137":99,"138":97,"139":116,"140":105,"141":111,"142":110,"143":32,"144":105,"145":115,"146":32,"147":110,"148":111,"149":116,"150":32,"151":97,"152":117,"153":116,"154":104,"155":101,"156":110,"157":116,"158":105,"159":99,"160":97,"161":116,"162":101,"163":100,"164":34,"165":44,"166":32,"167":34,"168":82,"169":101,"170":113,"171":117,"172":101,"173":115,"174":116,"175":101,"176":100,"177":85,"178":114,"179":108,"180":34,"181":58,"182":34,"183":47,"184":118,"185":49,"186":47,"187":103,"188":116,"189":102,"190":115,"191":47,"192":118,"193":101,"194":104,"195":105,"196":99,"197":108,"198":101,"199":112,"200":111,"201":115,"202":47,"203":98,"204":117,"205":115,"206":101,"207":115,"208":34,"209":44,"210":32,"211":34,"212":82,"213":101,"214":113,"215":117,"216":101,"217":115,"218":116,"219":101,"220":100,"221":77,"222":101,"223":116,"224":104,"225":111,"226":100,"227":34,"228":58,"229":34,"230":71,"231":69,"232":84,"233":34,"234":32,"235":125,"236":32,"237":125},"headers":{"cache-control":"no-cache=\"set-cookie\"","content-type":"application/json","date":"Wed, 02 Nov 2016 04:39:48 GMT","server":"Apache-Coyote/1.1","set-cookie":["AWSELB=777BE349184966AA129955C33D987E6DD8D703B5EF98646B5F5BFCF6E8BE2BEE935448000E243FA1120100A38CFDC57F4F47F05B5BDB933678B8A8E1D7005B3AB82BA260F3;PATH=/"],"content-length":"238","connection":"Close"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"api.transport.nsw.gov.au","port":443,"hostname":"api.transport.nsw.gov.au","hash":null,"search":null,"query":null,"pathname":"/v1/gtfs/vehiclepos/buses","path":"/v1/gtfs/vehiclepos/buses","href":"https://api.transport.nsw.gov.au/v1/gtfs/vehiclepos/buses"},"method":"GET","headers":{"$ref":"$[\"socket\"][\"_httpMessage\"][\"agent\"][\"options\"][\"headers\"]"}}}