must be str, not NoneType: TypeError
MartinThoma opened this issue · 2 comments
MartinThoma commented
I tried "Using Boto To Automatically Gather AWS Credentials" and get:
File "/var/task/aws_requests_auth/aws_auth.py", line 165, in get_aws_request_headers
self.service)
File "/var/task/aws_requests_auth/aws_auth.py", line 27, in getSignatureKey
kDate = sign(('AWS4' + key).encode('utf-8'), dateStamp)
TypeError: must be str, not NoneType
MartinThoma commented
Aparently the key
is None
. I wonder where the error message comes from, because locally I get
>>> ('AWS4' + None).encode('utf-8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't convert 'NoneType' object to str implicitly
Anyway, probably getSignatureKey
should have something like
if not isinstance(key, str):
raise TypeError('key should be of type string, but was of type {}'.format(type(key)))
there should be a TypeError raised by
DavidMuller commented
If you are using the BotoAWSRequestsAuth
util, you'll also need to be sure that boto3 is able to find credentials somewhere on your machine. Making sure boto3 can find creds on your machine is something mentioned in the README, although perhaps somewhat indirectly.