2

I'm running into a no attribute error with the latest version of boto3.

As far as I'm concerned, I'm referencing the latest documentation (here -- note '/api/latest' in the URL), so I'm at a loss as to what I'm doing wrong.

The code is really no different than any other boto3 client call:

response = boto3.client('location').search_place_index_for_suggestions(
    BiasPosition=response['Results'][0]['Place']['Geometry']['Point'],
    FilterCountries=['USA'],
    IndexName='CTA-Place-Index',
    MaxResults=1,
    Text='Major Airport'
)

I know the client name is correct, because I'm making a similar call immediately prior to the the above block, with this:

response = boto3.client('location').search_place_index_for_text(
    FilterCountries=['USA'],
    IndexName='CTA-Place-Index',
    MaxResults=1,
    Text='90210'
)

... which works fine ...

Anyone have any ideas?

UPDATE: no luck

Perhaps someone else could run this and verify that this is affecting more than just me:

client = boto3.client('location')
object_methods = [method_name for method_name in dir(client) if callable(getattr(client, method_name))]
print(object_methods)

Credit for the "introspection" code: here

Dan
  • 4,197
  • 6
  • 34
  • 52
  • 2
    The API is generated on the fly, with the data (method-names, params, etc.) coming from `botocore`. So make sure that both modules are the latest version. – Bert Blommers Dec 11 '21 at 18:41
  • 1
    It’s a brand new lambda; if the modules aren’t up-to-date, then it’d have to be an AWS issue – Dan Dec 11 '21 at 22:53

1 Answers1

1

If you are relying on the SDK provided by Lambda as part of their runtime, it may be out of date. Lambda does not immediately update their SDK with every SDK release. You may need to include the latest SDK yourself. Refer to the below knowledge center article.

https://aws.amazon.com/premiumsupport/knowledge-center/lambda-layer-aws-sdk-latest-version/

ouflak
  • 2,458
  • 10
  • 44
  • 49
User78333
  • 11
  • 2
  • Thank you -- I created a Layer with the most-recent version of Boto3 and was able to call the method. Unfortunately, I'm now hitting a permissions error in IAM b/c the resource also simply doesn't exist in IAM's policies ... so no clear way to solve *that* piece of the puzzle. Ideas appreciated! – Dan Dec 19 '21 at 09:42
  • Also wild -- I simply created a policy in IAM with the likely name for the resource. IAM warned me that such a resource doesn't exist ... but, then it worked, lol. – Dan Dec 19 '21 at 09:55