[FIXED] Error creating marker

What I’m trying to do:
Some long running code is throwing the following error

ExternalError: TypeError: $lattr66798.tp$getattr is not a function

from this line
m = GoogleMap.Marker(position=results[0].geometry.location)

What I’ve tried and what’s not working:
I have checked stable versions of the app which have not had changes to this form in a long time and the error persists.

Clone link:
App contains my Maps API key so not posted but happy to share with Support on request.

That does sound like a bug at our end! Sorry about that. We’re investigating, and should have an update for you shortly.

1 Like

:slight_smile: Thank you for the speedy assistance

This should now be fixed. Apologies for the interruption - please let us know if you’re still seeing the issue.

1 Like

Thanks @daviesian - all back working again

1 Like

What I’m trying to do:
I have a customer, who is running Chrome browser on Windows 11, and is getting a TypeError: $lattr3943.tp$getattr is not a function when trying to find the LatLng from an address.

I have not been able to reproduce this on my own machine, but he is getting the error every time he tries to call the GoogleMap.geocode().

Code handling the the call to GoogleMap.geocode():

  def get_latlng(self, address: str):
    try:
      # Try to return cached LatLng to avoid doing more geocoding than needed
      return [self._cached[address]]
    except KeyError as ke:
      try:
        results = GoogleMap.geocode(address=address)
                
        if len(results) > 1:
          for r in results:
            self._cached[r.formatted_address] = r.geometry.location
          return results
        else:
          self._cached[results[0].formatted_address] = results[0].geometry.location
          return [self._cached[results[0].formatted_address]]
        
      except ExternalError as ee:
        print(ee)  # <== This is where the "TypeError: $lattr3943.tp$getattr is not a function" is thrown
        return None
      except Exception as e:
        print(f'Exception while trying to geocode: {e}')

Code called by click event on Form:

  def btn_address_get_latlng_click(self, **event_args):
    locations = geocoder.get_latlng(self.tb_address.text)
    try:
      if len(locations) == 1:
        self.tb_address_lat.text = locations[0].lat()
        self.tb_address_lng.text = locations[0].lng()
      elif len(locations) > 1:
        # Multiple addresses returned, let user choose correct one
        items = []
        for l in locations:
          items.append({
            "formatted_address": l.formatted_address,
            "location": l
          })       
            
        rp = RepeatingPanel(item_template=Geocode_Result_Template, items=items)
        choice = alert(
          rp,
          large=True,
        )
      else:
        alert("Address not found", title="Error")
    except TypeError as te:
      alert("Address not found", title="Error")

Clone link:
Unable to share a full clone of my app, as it contains customer data, but can provide a clone to staff, if needed.

I have tried to find the error in the GoogleMap API docs, but without luck.

Any help is appreciated greatly!

@ejl moved to this thread. The bug should now be fixed.

Hi Stu,
Thank you for the quick response!

My customer is still reporting the same error, and I see the same error in my App Logs this morning.

Is there something I can ask him, to narrow the issue down?

They might be using a cached version of the page.
See if a simple refresh will help (and possibly a hard refresh, clearing their cache)

See if it works for them in a different browser.

2 Likes

Of course.

Fixed :+1:

Thank you for the quick response!

1 Like