node-gtfs icon indicating copy to clipboard operation
node-gtfs copied to clipboard

import.js throws an error because attribution_id is missing but the spec says it's optional

Open Unclearogre opened this issue 1 year ago • 2 comments

I'm trying to get the MMM-transitfeed module working with my MagicMirror to show arrival times for the San Francisco Muni.

I'm using these endpoints:

http://api.511.org/transit/datafeeds?api_key=[your_key]&operator_id=SF
http://api.511.org/transit/tripupdates?api_key=[your_key]&agency=SF

which seem to return data but gtfs is throwing an error saying that attribution_id is required:

[2024-06-27 09:20:14.694] [ERROR] (node:2014) UnhandledPromiseRejectionWarning: Error: Missing required value in attributions.txt for attribution_id on line 2.
    at formatLine (file:///home/pi/MagicMirror/modules/MMM-transitfeed/node_modules/gtfs/lib/import.js:448:13)
    at Parser.<anonymous> (file:///home/pi/MagicMirror/modules/MMM-transitfeed/node_modules/gtfs/lib/import.js:622:28)

The spec that I found, however, seems to indicate that attribution_id is optional.

Is this a node-gtfs issue, an MMM-transitfeed problem, or something else?

Unclearogre avatar Jun 27 '24 16:06 Unclearogre

I found a work-around, I think. I edited the attributions.js file in node_modules/gtfs/models/gtfs to set the required flag to false. That seems to work.

Unclearogre avatar Jun 27 '24 17:06 Unclearogre

Thanks for pointing out that attribution_id is optional. I'll update the schema and publish and updated version soon.

brendannee avatar Jun 27 '24 18:06 brendannee

I just published https://github.com/BlinkTagInc/node-gtfs/releases/tag/4.13.0 which makes attribution_id optional - let me know if this works for you or if there are any other issues.

brendannee avatar Jul 10 '24 22:07 brendannee