BlinkTagInc / gtfs-to-html

Build human readable transit timetables as HTML or PDF from GTFS.
https://gtfstohtml.com
MIT License
181 stars 57 forks source link

No Timetables found for timetable_page_error while using v2.0.1 #114

Closed holzmandee closed 3 years ago

holzmandee commented 3 years ago

Hello - We are using this great application to provide timetables for our local transportation agency here in the Columbia River Gorge. We've moved our site to a new CentOS 7.9 server and have upgraded to gtfs-to-html v2.0.1, and for some reason, cannot get the program to run on our new server without a no timetables found for timetable_page_id=8 ...etc warning. We are using node v14.17.0 (we also tried v12.14.0 to see if that would work), but oddly the program throws warnings while generating timetables - Oddly, then timetables are inserted into the project directory but they are incomplete and unable to be displayed as web pages - here's a screenshot of the warning: image

We tried using several transit configuration files, including the sample config file that downloads routes for Bart (http://www.bart.gov/dev/schedules/google_transit.zip - to make sure the problem wasn't with one of our local configuration files).

I see that gtfs-to-html is designed to throw that error in the 'gtfs-to-html.js' file here:

/* eslint-disable no-await-in-loop */
for (const timetablePageId of timetablePageIds) {
    try {
       const timetablePage = await getFormattedTimetablePage(timetablePageId, config);

    if (timetablePage.consolidatedTimetables.length === 0) {
        throw new Error(`No timetables found for timetable_page_id=${timetablePage.timetable_page_id}`);
   }

For the life of me I can't figure out how to solve the problem or find out why it's happening. Thanks in advance for any help or suggestions you can provide.

brendannee commented 3 years ago

Thanks for the detailed notes.

When you don't have a timetables.txt in your GTFS, GTFS-to-HTML tries to guess which timetables to build. It looks like it should be generating timetables for all of your routes, but some of them don't run on weekends so it is just passing warnings that some possible timetables are getting skipped.

Are there any timetables you expected to be built which are not?

I recommend adding a timetables.txt file to your GTFS before running to control exactly which routes/directions/days get built as timetables. https://gtfstohtml.com/docs/timetables

holzmandee commented 3 years ago

Thanks alot for your reply! I appreciate the help - that makes sense - I understand the warnings more clearly now, and will ask our local transportation agencies to include a timetables.txt file to their GTFS

Also, the timetables that were generated when we ran the program on our GTFS files were missing the <html> <head> and <body> tags. I mistakenly confused this output with the warnings that were generated. I mistakenly thought that they could be related.

So regarding our timetables with the missing <html> <head> and <body> tags, I checked in our config file, and 'noHead' is set to 'false', which I thought means 'do not skip those tags', so I can't figure out why our timetables are missing the Head and Footer.

You can see the differences here: timetables generated with older version of gtfs-to-html on current server: http://gorgetranslink.com/html/skamania/timetables/a0802b511111000_gorge_0_mon-fri.html

timetables generated on new development server (using temporary URL from hosts.cx) using gtfs-to-html v2.0.1 http://1ui2b.hosts.cx/html/skamania/20190920-20191020/a0802b511111000_gorge_0_mon-fri.html

Maybe I'm missing an obvious setting or misunderstanding the 'nohead' option - any feedback you have on the missing html, head and body tags would be welcome!

On another interesting note regarding the 'No Timetable...` warnings, we set up a development page where we could run the gtfs-to-html command and generate timetables from a web page (kind of like your hosted web app, but not as good).

This page allows a logged in user to choose a node app for different transportation districts from a drop down list (we have several transportation districts in our area), then run the app which contains the location of the config.json file, etc.

Weirdly, when any warnings were outputted while generating timetables (such as 'No timetables found...') , we received a 'this.stream.clearLine is not a fuction' error, which I assume means we have some node.js misconfiguration or security setting on our server (I'm not a node.js expert): this stream clearLine is not a function

So to get the program to run from a PHP page on our server without the error, I disabled the timetable warnings by commenting them out in /lib/gtfs-to-html.js on lines 92 & 125:

//bar.interrupt(formatWarning(warning)); //bar.interrupt(formatWarning(error.message));

Then, with warnings disabled, the program ran successfully and the timetables were generated (without the head and footer though).

Have you heard of other users encountering that 'this.stream.clearLine is not a function' error?

holzmandee commented 3 years ago

Hi, thanks for the version 2.0.4 release, which solved the missing the <html> <head> and <body> tags on our generated timetable pages despite our 'noHead' configuration option set to 'false'.