ibi-group / datatools-ui

Core application for IBI's transit data tools suite.
https://data-tools-docs.ibi-transit.com/en/latest/
MIT License
119 stars 76 forks source link

building v5.0.0. brings YAML errors #820

Closed wkulesza closed 2 years ago

wkulesza commented 2 years ago

Observed behavior (please include a screenshot if possible)

When building the newest tagged version (v5.0.0) of datatools-ui, together with datatools-server (be it 'dev' or any other new working branch) this error shows up:

{"log":"/opt/datatools-ui/node_modules/yamljs/lib/Parser.js:404\n","stream":"stderr","time":"2022-07-20T09:51:12.936095886Z"}
{"log":"            throw e;\n","stream":"stderr","time":"2022-07-20T09:51:12.936102864Z"}
{"log":"            ^\n","stream":"stderr","time":"2022-07-20T09:51:12.936108674Z"}
{"log":"[ParseMore [Error]: Malformed inline YAML string (\"The friday field contains a binary value that indicate).] {\n","stream":"stderr","time":"2022-07-20T09:51:12.93971789Z"}
{"log":"  parsedLine: 758,\n","stream":"stderr","time":"2022-07-20T09:51:12.939757083Z"}
{"log":"  snippet: 'helpContent: \"The friday field contains a binary value that indicate'\n","stream":"stderr","time":"2022-07-20T09:51:12.939764627Z"}
{"log":"}\n","stream":"stderr","time":"2022-07-20T09:51:12.939770706Z"}

And ultimately, nginx which is used to start the DT, shows 502 Bad Gateway.

Is it correct to use node v10 and/or v12 ? We tried with both versions.

Is there a newer configuration element that could break this? There are also other js errors appear in that building process (when trying different branches)

Expected behavior

Datatools should be without that error mentioned above.

Steps to reproduce the problem

use the 5.0.0 version for datatools and dev (or other active branch) for datatools-server, run the project.

Any special notes on configuration used

Also, tried to run this using dockerized environment, with no luck.

Version of datatools-ui and datatools-server if applicable (exact commit hash or branch name)

ui: v5.0.0 server: dev/v4.1.0

miles-grant-ibigroup commented 2 years ago

Thanks for the detailed report! Are you using a custom config file?

wkulesza commented 2 years ago

@miles-grant-ibigroup no, not really, just the standard ones, but with own auth0 details and own jpg files etc. Those config files I have with a running instance of DT - server was master (/dt-v3.2.0-1516-g46cb2f0.jar, server: 46cb2f, ui was 79bd7e, and dev but cloned may 18th.

miles-grant-ibigroup commented 2 years ago

Thanks for letting me know. The issue is coming from the gtfs.yml file, specifically line 779. I can see looking at the file that it uses some encoding which might be causing the problem on certain operating systems. Go ahead and try to convert the file to UTF-8 or perhaps to ascii and let me know if that fixes the problem for you!

wkulesza commented 2 years ago

@miles-grant-ibigroup thanks for helping out. gtfs.yml file was already in utf-8, so i recreated it in ascii.(using fork here: https://github.com/goeuropa/datatools-ui/blob/dev/gtfs.yml) now tried to build and got this error (pasting the whole thing as there's not too many lines):

{"log":"Browserslist: caniuse-lite is outdated. Please run:\n","stream":"stderr","time":"2022-07-20T10:53:11.629467259Z"}
{"log":"npx browserslist@latest --update-db\n","stream":"stderr","time":"2022-07-20T10:53:11.629530757Z"}
{"log":"\n","stream":"stderr","time":"2022-07-20T10:53:11.629540763Z"}
{"log":"Why you should do it regularly:\n","stream":"stderr","time":"2022-07-20T10:53:11.629546036Z"}
{"log":"https://github.com/browserslist/browserslist#browsers-data-updating\n","stream":"stderr","time":"2022-07-20T10:53:11.629550981Z"}
{"log":"\n","stream":"stderr","time":"2022-07-20T10:53:25.178586653Z"}
{"log":"/opt/datatools-ui/node_modules/yamljs/lib/Parser.js:404\n","stream":"stderr","time":"2022-07-20T10:53:25.178617506Z"}
{"log":"            throw e;\n","stream":"stderr","time":"2022-07-20T10:53:25.17862226Z"}
{"log":"            ^\n","stream":"stderr","time":"2022-07-20T10:53:25.178625795Z"}
{"log":"[ParseMore [Error]: Malformed inline YAML string (\"The from_).] {\n","stream":"stderr","time":"2022-07-20T10:53:25.182636424Z"}
{"log":"  parsedLine: 978,\n","stream":"stderr","time":"2022-07-20T10:53:25.18266236Z"}
{"log":"  snippet: 'helpContent: \"The from_'\n","stream":"stderr","time":"2022-07-20T10:53:25.182666706Z"}
{"log":"}\n","stream":"stderr","time":"2022-07-20T10:53:25.182670384Z"}
miles-grant-ibigroup commented 2 years ago

I've investigated this a little further and the file definitely has some issues, sorry. I'll add fixing it to our priorities list.

For now, the problem is the spaces used in that line of the file aren't standard. If you use an editor like notepad++ on windows or hex fiend on mac you'll see the problem. Replacing all the problematic spaces with "normal" ones should fix the problem! Sorry about the complication, and I hope you're able to get it working.

miles-grant-ibigroup commented 2 years ago

I've fixed the file in #821, please let me know if it works for you!

wkulesza commented 2 years ago

@miles-grant-ibigroup thanks, it did help and i think the next error causing datatools-ui might be related to something different (and to do with missing item in config?) - if yes and yes, i could open another issue for that ?

{"log":"done building...\n","stream":"stdout","time":"2022-07-20T14:24:59.754020342Z"}
{"log":"file:///usr/local/lib/node_modules/serve/build/main.js:130\n","stream":"stderr","time":"2022-07-20T14:24:59.874971044Z"}
{"log":"      url.port = url.port ?? \"3000\";\n","stream":"stderr","time":"2022-07-20T14:24:59.875008664Z"}
{"log":"                           ^\n","stream":"stderr","time":"2022-07-20T14:24:59.875016101Z"}
{"log":"\n","stream":"stderr","time":"2022-07-20T14:24:59.875022084Z"}
{"log":"SyntaxError: Unexpected token '?'\n","stream":"stderr","time":"2022-07-20T14:24:59.87502761Z"}
{"log":"    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)\n","stream":"stderr","time":"2022-07-20T14:24:59.87503347Z"}
{"log":"    at async link (internal/modules/esm/module_job.js:42:21)\n","stream":"stderr","time":"2022-07-20T14:24:59.875039339Z"}
miles-grant-ibigroup commented 2 years ago

Are you using mastarm or another build tool? The ?? used here is an experimental feature and needs to be enabled in babel (https://babeljs.io/docs/en/babel-plugin-proposal-nullish-coalescing-operator). Mastarm will enable it for you, but you may have to enable it manually if you are using a different build tool.

wkulesza commented 2 years ago

@miles-grant-ibigroup my command is: yarn (npm bin)/mastarm build --env production && serve -p 9966 for that error should i open another issue ? i'm using fix-gtfs-yml-encoding for datatools-ui and dev for datatools-server

miles-grant-ibigroup commented 2 years ago

Yes mastarm production building has some problems -- does mastarm build --env dev --serve work for you?

wkulesza commented 2 years ago

@miles-grant-ibigroup when replaced production with dev i got:

{"log":"(node:27) [DEP0128] DeprecationWarning: Invalid 'main' field in '/opt/datatools-ui/node_modules/mold-source-map/package.json' of 'mold-source-map.js'. Please either fix that or report it to the module author\n","stream":"stderr","time":"2022-07-21T11:22:22.406237013Z"}
{"log":"(Use `node --trace-deprecation ...` to show where the warning was created)\n","stream":"stderr","time":"2022-07-21T11:22:22.406281114Z"}
{"log":"/opt/datatools-ui/node_modules/mastarm/lib/logger.js:26\n","stream":"stderr","time":"2022-07-21T11:22:57.306354806Z"}
{"log":"  const strippedLinks = text.replace(/\u003c[^|\u003e]+\\|([^\u003e]+)\u003e/g, '$1')\n","stream":"stderr","time":"2022-07-21T11:22:57.306385453Z"}
{"log":"                             ^\n","stream":"stderr","time":"2022-07-21T11:22:57.306390956Z"}
{"log":"\n","stream":"stderr","time":"2022-07-21T11:22:57.306394651Z"}
{"log":"TypeError: text.replace is not a function\n","stream":"stderr","time":"2022-07-21T11:22:57.306399464Z"}
{"log":"    at emojify (/opt/datatools-ui/node_modules/mastarm/lib/logger.js:26:30)\n","stream":"stderr","time":"2022-07-21T11:22:57.306404965Z"}
{"log":"    at Object.logToErrorConsole [as error] (/opt/datatools-ui/node_modules/mastarm/lib/logger.js:5:65)\n","stream":"stderr","time":"2022-07-21T11:22:57.306410667Z"}
{"log":"    at /opt/datatools-ui/node_modules/mastarm/bin/mastarm-build:56:14\n","stream":"stderr","time":"2022-07-21T11:22:57.30641659Z"}
{"log":"\n","stream":"stderr","time":"2022-07-21T11:22:57.306422567Z"}
{"log":"Node.js v18.6.0\n","stream":"stderr","time":"2022-07-21T11:22:57.306428073Z"}
miles-grant-ibigroup commented 2 years ago

You need to be using node 14! datatools-ui is only compatible with node 12 and node 14

wkulesza commented 2 years ago

@miles-grant-ibigroup hi, changing to node 14 did the trick. Thanks a lot - it wouldn't be possible without your help. I managed to start ui and server - can't see any significant changes in the ui (dev branch). Shouldn't there be new items visible ?

miles-grant-ibigroup commented 2 years ago

Happy I was able to help and happy you got it working!

There are no major changes in the new version -- mostly just bug fixes and a few minor feature tweaks.

wkulesza commented 1 year ago

Yes im using mastarm

W dniu śr., 20.07.2022 o 16:28 miles-grant-ibigroup < @.***> napisał(a):

Are you using mastarm or another build tool? The ?? used here is an experimental feature and needs to be enabled in babel ( https://babeljs.io/docs/en/babel-plugin-proposal-nullish-coalescing-operator). Mastarm will enable it for you, but you may have to enable it manually if you are using a different build tool.

— Reply to this email directly, view it on GitHub https://github.com/ibi-group/datatools-ui/issues/820#issuecomment-1190358371, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHXUGGCWSR26PDO7CWSA6TVVAEIPANCNFSM54DAJJRA . You are receiving this because you authored the thread.Message ID: @.***>

-- Wojciech Kulesza

Właściciel / Owner

goEuropa Polska Wojciech Kulesza +48616248682 @.*** www.goeuropa.eu ul. 28 Czerwca 1956r nr 400 Kiedy przyjedzie autobus? Sprawdż na www.kiedybus.pl https://www.kiedybus.pl/