Open nbjwo1 opened 2 years ago
I believe this happens when the resolver search domain is unset / empty, and the resolver domain is empty as well (set to empty string in the lambda_utils
file).
I was able to replicate this error by running the dns_lookup
function locally. When running the function as-is, it worked as it should. When I added myResolver.search = ''
in the function, it gave the same error as @nbjwo1 got. I'm guessing the search domain is picked up from my OS when running locally, and that it's not set when running in a Lambda.
As a workaround you can make sure the TARGET_FQDN
contains a trailing period, so my.example.com.
(which works since using a search domain is no longer necessary) in favor of my.example.com
(which the dnspython library (correctly) does not percieve as an absolute hostname).
Have anyone run into this error...
[ERROR] 2022-09-22T13:53:11.531Z 173750ff-4fb7-4f2e-a757-316995010d32 ERROR: 'str' object has no attribute 'labels' Traceback (most recent call last): File "/var/task/elb_hostname_as_target.py", line 123, in lambda_handler dns_lookup_result = utils.dns_lookup(DNS_SERVER, TARGET_FQDN, "A") File "/var/task/lambda_utils.py", line 225, in dns_lookup lookupAnswer = myResolver.query(domainname, record_type) File "/var/task/dns/resolver.py", line 916, in query qnames_to_try.append(qname.concatenate(self.domain)) File "/var/task/dns/name.py", line 682, in concatenate labels.extend(list(other.labels)) AttributeError: 'str' object has no attribute 'labels' [ERROR] 2022-09-22T13:53:11.532Z 173750ff-4fb7-4f2e-a757-316995010d32 ERROR: Invocation Failed