Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: object of type 'NoneType' has no len() #95

Open
mp-strachan opened this issue Apr 1, 2024 · 0 comments
Open

TypeError: object of type 'NoneType' has no len() #95

mp-strachan opened this issue Apr 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mp-strachan
Copy link

Summary

Container kept crashing when trying to create a new record.

Relevant logs and/or screenshots

Empty records causing a type error:

TypeError: object of type 'NoneType' has no len()

Possible fixes

If appears that line #176 (records = cf.zones.dns_records.get(domain_info['zone_id'], params={u'name': name})) is returning an empty object if searched record does not exist. When evaluating the length in line #186 (if len(records) == 0:) a type error is thrown.

Adding a type check resolved the issue. if (records is None or len(records) == 0):

@mp-strachan mp-strachan added the bug Something isn't working label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant