help with Invalid Wire Type error in protobuf gem with MTA feed?

527 views
Skip to first unread message

Elise Harris

unread,
Mar 22, 2015, 3:18:39 PM3/22/15
to mtadevelop...@googlegroups.com
About five days ago I finished a Rails app that parsed the MTA GTFS feed and texted results to users. It worked in both Cloud 9 and heroku. Now it doesn't work in either. I get an "invalid wire type" error message for the line 

feed = Transit_realtime::FeedMessage.decode(data)

that i just copied and pasted from the gtfs-realtime-bindings documentation.

Anyone know why? Is the MTA GTFS currently working fine? any major changes? I hope to find out if problem is on my end or external.

one c9 error message reads like this: 
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/protobuf-3.4.4/lib/protobuf/decoder.rb:31:in `read_field': 6 (Protobuf::InvalidWireType)
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/protobuf-3.4.4/lib/protobuf/decoder.rb:10:in `decode_each_field'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/protobuf-3.4.4/lib/protobuf/message/serialization.rb:41:in `decode_from'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/protobuf-3.4.4/lib/protobuf/message/serialization.rb:35:in `decode'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/protobuf-3.4.4/lib/protobuf/message/serialization.rb:11:in `decode'
        from lib/assets/sendsms.rb:23:in `<main>'

ihave a bunch of heroku logs but don't want to email out an overly long file

Thanks for any advice
Elise

Brian Ferris

unread,
Mar 23, 2015, 3:54:43 AM3/23/15
to mtadevelop...@googlegroups.com
Can you try logging the "data" variable right before you decode it?  If it's proper GTFS-realtime data, it will probably look like a mess of unintelligible binary (that's actually good).  However, if you can actually read the data and it looks like you are getting a text response of some kind (aka not binary), that might indicate you are not getting the feed you thought you were.  Perhaps due to a bad url, bad authentication, something else...

(Also, it's a bit confusing when you refer to the MTA GTFS.  I think you actually mean GTFS-realtime (aka realtime data), not GTFS (aka static schedule data))

--
You received this message because you are subscribed to the Google Groups "mtadeveloperresources" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mtadeveloperreso...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Elise Harris

unread,
Mar 23, 2015, 9:32:39 AM3/23/15
to mtadevelop...@googlegroups.com
I got this message when the app worked

"Sent from your Twilio trial account - Hi elise. the 2,3,4,5, trains are experiencing delays. [{:trip_id=>"102900_5..N68R", :route_id=>"5"}]."

Thanks for clarifying about the different kinds of gtfs feeds. I had misunderstood that. I am working with the URL for the real time feed. I had done tests in the past where I got a 500p data file of all the trip updates, or a shorter file of alerts. The former came as csv and json cause of how we wrote the ruby code. But I may be using something I don't understand.

On Mar 23, 2015, at 3:54 AM, "'Brian Ferris' via mtadeveloperresources" <mtadevelop...@googlegroups.com> wrote:

> Groups "mtadeveloperresources" group.
Reply all
Reply to author
Forward
0 new messages