Critical -> getCurrentGeolocation( ) not working?

Question:
I’m facing an issue with a geolocation feature that retrieves latitude and longitude from the user to provide access to certain features. The feature always throws the following error in the console:

“Uncaught (in promise) DOMException: Failed to execute ‘postMessage’ on ‘MessagePort’: function toJSON() { [native code] } could not be cloned”

Product:
Wix Studio and Editor X sites

What are you trying to achieve:

I have implemented a feature that uses the promise of the getCurrentGeolocation() API. If the promise resolves successfully, it retrieves the latitude and longitude and allows the user to continue. If it fails, it prompts the user to enable location services in their browser.

Since around June 12, 2024, this feature consistently triggers the following console error:

Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'MessagePort': function toJSON() { [native code] } could not be cloned.
    at https://static.parastorage.com/services/wix-thunderbolt/dist/thunderbolt-commons.8e38bc77.bundle.min.js:1:18777
(anonymous) @ comlink.ts:343
Promise.then (async)
e @ comlink.ts:341

What have you already tried:

  1. Adding a setTimeout as advised in the API documentation, but the issue persists.
  2. Attempting to modify the file https://static.parastorage.com/services/wix-thunderbolt/dist/thunderbolt-commons.8e38bc77.bundle.min.js:1:18777, but I don’t have access to modify Wix core code.
export async function button3_click(event) {
  try {
    geoLocation = await  wixWindowFrontend.getCurrentGeolocation()
    console.log('response of geoLocation: ', geoLocation)
    //As it resolves I can unhide the map...
    $w('#imageX4').show()
  } catch (error) {
    console.log('error while retrieving location: ', error)
    $w('#imageX4').hide()
  }

}

And:

  try {
    setTimeout(async() => {
      geoLocation = await wixWindowFrontend.getCurrentGeolocation();
      console.log('response of geoLocation: ', geoLocation);
      // As it resolves I can unhide the map...
      $w('#imageX4').show();
    }, 1200);
  } catch (error) {
    console.log('error while retrieving location: ', error);
    $w('#imageX4').hide();
  }
}

Additional information:

Here is a video showing the error: [link to video]

Working on:

Screen Shot 2024-06-20 at 12.34.13

Google Chrome
Version 126.0.6478.62 (Official Build) (x86_64)

I think this is relevant because the problem is not replicable in a windows device, weird…
Obviously I’ve tried Incognito, erasing cache and all that stuff…

Any advice or solutions to resolve this issue would be greatly appreciated!

I unfortunately don’t have any workarounds but the best place to report this is customer care: Contact Wix

Yep, I uploaded my ticket four days ago and still haven’t received any response; the issue continues. However, I’ve found a workaround using custom elements. Thanks a lot for your help.

1 Like