GPSIO import - console errors in new GUI

caver456's Avatar

caver456

15 May, 2021 05:01 AM

Hi - with the new GUI, GPSIO import causes a hang before the checkbox list is shown, for both Mass Storage and Garmin Serial devices.

For a Garmin Serial device (GPSMap 60), the following error shows in the browser javascript console. I'm using Chrome 90.0.4430.212 on Windows 10.

VM44:1 Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.success (all.js?ts=1621000765224:2)
    at l (all.js?ts=1621000765224:2)
    at Object.fireWith [as resolveWith] (all.js?ts=1621000765224:2)
    at k (all.js?ts=1621000765224:2)
    at XMLHttpRequest.<anonymous> (all.js?ts=1621000765224:2)

That was for a Garmin 60 (Garmin Serial Protocol - not Mass Storage). The hang occurs with the 'Import From GPS' popup showing, with this text:

Reading data from GPS . . .
Data read! May take a minute to process - be patient . . .

The OK button on the popup closes the dialog and everything else seems to still function normally.

Export with GPSIO does work for the 60.

For a USB Mass Storage device, GPSIO hangs at the same point, with this text shown in the dialog (as expected):

Reading data from GPS . . .
Data read! May take a minute to process - be patient . . .
Showing data from 9 out of 9 total GPX file(s). Click the GPSIO Extension icon for details.

But, nothing appears in the browser javascript console as it did with the 60. Again the OK button closes the popup and everything else seems to work.

I checked the extension background page and the wrapper.py log file each time and did not see any immediate giveaways.

On a search yesterday, the person who was doing GPS transfers reported the same hang on every attempt. They were using sartopo.com instead of CTD.

Trying CTD 4210, on the same system and the same browser, GPSIO import and export works as expected for 60 and for Mass Storage.

Thanks

  1. 1 Posted by caver456 on 25 Oct, 2021 01:28 AM

    caver456's Avatar

    Hi, I'd like to update this with some new information:

    Most of the report has not changed: the hang still happens 100% of the time for both sartopo.com and caltopo.com, but works correctly for CTD 4210 and 4214.

    The update is that the Chrome javascript console now shows an error at the instant that the 'success' lines show up in the dialog:

    main.js?ts=1634940442884:2 POST https://caltopo.com/m/0E00R 405
    send @ main.js?ts=1634940442884:2
    ajax @ main.js?ts=1634940442884:2
    p.c.sarsoft.GPSComms.handleResponse @ main.js?ts=1634940442884:2
    (anonymous) @ main.js?ts=1634940442884:2
    postMessage (async)
    (anonymous) @ content_script.js:9

    Comparing the caltopo.com main.js function p.c.sarsoft.GPSComms/handleResponse to that in CTD (all.js rather than main.js), I only see one difference, though I'm not sure if this is an issue:

    in the online main.js:
    u.a.ajax({type: "POST"...

    in the CTD all.js:
    c.a.ajax({type: "POST"...

    Where 'c' is the second-level part of the function name in both cases. TO the untrained eye, is it possible that the online main.js should also say c.a.ajax instead of u.a.ajax?

    I'll continue trying to find out why the host process is giving an 'Unchecked runtime.lastError: Native host has exited.' message both on success (CTD) and on hang (online). I believe the host has always exited in this manner, but will see if I can clean it up anyway.

    Also as Matt suggested a few months back I will try to install this on a Mac to see if there are any differences.

    Thanks!

  2. 2 Posted by caver456 on 25 Oct, 2021 02:24 PM

    caver456's Avatar

    Screenshot attached showing the (pretty-printed) piece of code in main.js with the error - looks like a 405 from the server is the immediate cause.

  3. 3 Posted by caver456 on 25 Oct, 2021 02:27 PM

    caver456's Avatar

    Sorry, looks like I chopped off the 405 in that screenshot. Here's a better one.

  4. 4 Posted by caver456 on 25 Oct, 2021 02:53 PM

    caver456's Avatar

    Here's a .har from Chrome's devtools, showing the request in question, with the 405 (Method Not Allowed) response with message 'request method 'POST' not supported'. Had to zip the file since the ticketing system doesn't like .har.

  5. 5 Posted by caver456 on 25 Oct, 2021 03:06 PM

    caver456's Avatar

    Maybe the request URL is the problem?

    Comparing the request on localhost (which does show the import filter checkbox dialog) to the one on caltopo.com (which does not), it's interesting that the request URL is different.

    Online: request url = https://caltopo.com/map.html when no map is open, or https://caltopo.com/m/0E00R when that map is open.

    Offline: request url = http://localhost:8080/rest/in

  6. 6 Posted by caver456 on 26 Oct, 2021 04:23 PM

    caver456's Avatar

    A bit more debug progress:

    Importing from file on caltopo.com (with map 0E00R open) sends the request to "https://caltopo.com/api/v0/import/0E00R"

    So I tried a chrome javascript local override to add that hardcode into main.js in the url attribute of the ajax call mentioned above.

    With that override in place, upon importing from GPSIO, the request does get sent to "https://caltopo.com/api/v0/import/0E00R" and returns 200, but the hang still happens (no checkbox dialog is shown) and there is a javascript error, almost identical to the one initially reported on this ticket:

    VM1142:1 Uncaught SyntaxError: Unexpected end of JSON input
        at JSON.parse (<anonymous>)
        at Object.success (main.js?ts=1635187415451:2)
        at l (main.js?ts=1635187415451:2)
        at Object.fireWith [as resolveWith] (main.js?ts=1635187415451:2)
        at S (main.js?ts=1635187415451:2)
        at XMLHttpRequest.<anonymous> (main.js?ts=1635187415451:2)

    I'm fairly certain it's not a problem with the gpx, because I exported the gpx as a file (not using GPSIO) and tried importing it as a file which worked as expected (did show the checkbox dialog).

    This kind of looks like the incorrect URL for that ajax request is one issue, but working around that with the hardcode above brings back the same previous existing issue with 'Unexpected end of JSON input'.

  7. 7 Posted by caver456 on 01 Nov, 2021 02:36 PM

    caver456's Avatar

    Just posting an update here that the solution was found in a five-line-edit to a local override of main.js. Posted that solution as a new help thread for consideration to be included.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

08 Dec, 2021 04:46 AM
07 Dec, 2021 11:49 PM
07 Dec, 2021 04:42 PM
07 Dec, 2021 02:47 PM
07 Dec, 2021 01:21 PM

 

06 Dec, 2021 11:17 PM
06 Dec, 2021 09:46 PM
06 Dec, 2021 07:46 PM
06 Dec, 2021 04:50 AM
05 Dec, 2021 12:56 AM
04 Dec, 2021 04:26 PM