tyrasd / overpass-turbo

A web based data mining tool for OpenStreetMap using the Overpass API.
https://overpass-turbo.eu
Other
920 stars 130 forks source link

Invalid query does not return error, but spins forever #667

Open mnalis opened 11 months ago

mnalis commented 11 months ago

When entering the query at wizard at http://overpass-turbo.eu/ which is not recognized, previously error was returned.

Now, it seems that it simply runs "running line" spinner forever, even when just build query is pressed (initially I was pressing build and run query and wondering why my seemingly simple/small query is taking so long to complete)

From example, entering in wizard "bicycle:repair" in Croatia and clicking build query just runs the spinner (I've waited for several minutes and given up so I do not know if it timeouts eventually): Screenshot 2023-10-23 at 17-18-01 overpass turbo

Modifying that query to "bicycle:repair"=* in Croatia returns correctly in about a second for build and run query (and immediately for just build query)

Started happening in last few weeks (I guess in or about the same major update which also broke "save/load from OSM" functionality from https://github.com/tyrasd/overpass-turbo/issues/665)

Possibly related issue: https://github.com/tyrasd/overpass-turbo/issues/657#issuecomment-1732616090

mnalis commented 10 months ago

For example, typing in wizard heritage in zagreb has the progress bar spinning forever, but in firefox console the error is thrown immediately.

IMHO, the error (at least a generic catch-all) should be returned to the user and operation aborted instead.

Uncaught TypeError: y is undefined
    Zl http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    I http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    P http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    fuzzy_search http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    Y http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:282
    __ http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:282
    __ http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:282
    Xl http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    __ http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:282
    update_ffs_query http://overpass-turbo.eu/assets/index-fd1ab5c5.js:763
    Gm http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:281
    Xl http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    Gm http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:281
    update_ffs_query http://overpass-turbo.eu/assets/index-fd1ab5c5.js:763
    onFfsRun http://overpass-turbo.eu/assets/index-fd1ab5c5.js:763
    onFfsBuild http://overpass-turbo.eu/assets/index-fd1ab5c5.js:763
    dispatch http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    handle http://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
urlParameters-314e2e15.js:274:1343
hfs commented 9 months ago

Overpass Turbo tries to load this file: https://overpass-turbo.eu/assets/en-US-a78e4a15.js but it’s empty:

const e={"en-US":{}};export{e as default};

When trying to build a query in the wizard for the first time this exception is logged:

Uncaught (in promise) Error: failed to load preset translations file: en-US
    f https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    Xl https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:274
    Gm https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:281
    update_ffs_query https://overpass-turbo.eu/assets/index-9bf03a2e.js:763
    onFfsRun https://overpass-turbo.eu/assets/index-9bf03a2e.js:763
    onFfsBuild https://overpass-turbo.eu/assets/index-9bf03a2e.js:763
    dispatch https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    handle https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    add https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    Bi https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    each https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    each https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    Bi https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    on https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    initClickHandler https://overpass-turbo.eu/assets/index-9bf03a2e.js:763
    each https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    each https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    initClickHandler https://overpass-turbo.eu/assets/index-9bf03a2e.js:763
    Qe https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    In https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    setTimeout handler*Deferred/then/J/< https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    N https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    fireWith https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    fire https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    N https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    fireWith https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    ready https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    setTimeout handler* https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    <anonymous> https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    <anonymous> https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:10
    <anonymous> https://overpass-turbo.eu/assets/urlParameters-314e2e15.js:13

When hitting the build query button a second time, the exception mentioned by @mnalis above is logged.

To me it seems there are two problems:

  1. The en-US .js file doesn’t seem to contain the content it is supposed to have?
  2. The wizard should be able to deal with this error and move on, or display a helpful error message, but not stay in the loading state forever.
hfs commented 8 months ago

The preset translation files come from https://github.com/openstreetmap/id-tagging-schema/tree/main/dist/translations

To me it seems that the language-country variants are meant to be merged with the language-without-country.files.

E.g. en.json contains the English presets. en-AU.json seems to contain only the terms that differ from en.json. en-US.json is empty.

I think when the requested language is en-AU, one would need to load en.json, then load en-AU.json and merge it. Entries from en-AU should overwrite entries from en.

What should happen if a user requests a language without translated presets, such as ee? It seems best to use English as fall back. So load en, then the language, then the language-country if it exists and merge them on top of each other.

mnalis commented 5 months ago

The wizard should be able to deal with this error and move on, or display a helpful error message, but not stay in the loading state forever.

Would just putting that language loading block in try...catch fix at least that part?

It is really making wizard quite annoying to use (i.e. I've by now had to train myself to never click on Build and execute but to always click first on Build query and only if that worked then move over the other side of screen to click Run.

hfs commented 3 months ago

As a workaround one can set the language to en in the settings.

mnalis commented 3 months ago

As a workaround one can set the language to en in the settings.

Umm, does that work for you @hfs ?

I've had language set to auto (which uses English), but I've now set it to en manually, and still trying to build invalid query like "bicycle:repair" in Croatia still spins for infinity for me.

hfs commented 3 months ago

@mnalis, yes, I’ve had the infinite spinning problem for a long time and switching to en has fixed it for me. I think I had to reload (F5) one time, but since then it works.

This is what I get now for the invalid query:

grafik

mnalis commented 2 months ago

@hfs thanks, that workaround works! I've had to (after changing to en) press ctrl-F5 to force refresh, though.

Still it would be good if it was fixed so it works out of the box for all users.

(also, I'll link related issue regarding Wizard UX not reporting errors: in case of https://github.com/tyrasd/overpass-turbo/issues/403 Wizard however does not spin forever, but instead silently ignores part of input as if it was never entered - and this workaround doesn't work)