You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importboto3importbotocoreprint('boto3 version:', boto3.__version__)
print('botocore version:', botocore.__version__)
# This is an instance that does not existinvalid_instance_id='i-12345678'ec2_client=boto3.client('ec2')
waiter=ec2_client.get_waiter('instance_exists')
waiter.wait(InstanceIds=[invalid_instance_id])
(Note that although this is an artificial example with an obviously-fake instance ID, the issue also reproduces occasionally with real instances if the waiter is called immediately after creating the instance.)
Output:
$ python3 repro.py
boto3 version: 1.3.1
botocore version: 1.4.15
Traceback (most recent call last):
File "repro.py", line 12, in <module>
waiter.wait(InstanceIds=[invalid_instance_id])
File "/usr/lib/python3.4/site-packages/botocore/waiter.py", line 53, in wait
Waiter.wait(self, **kwargs)
File "/usr/lib/python3.4/site-packages/botocore/waiter.py", line 292, in wait
if acceptor.matcher_func(response):
File "/usr/lib/python3.4/site-packages/botocore/waiter.py", line 194, in acceptor_matches
return expression.search(response) == expected
File "/usr/lib/python3.4/site-packages/jmespath/parser.py", line 524, in search
result = interpreter.visit(self.parsed, value)
File "/usr/lib/python3.4/site-packages/jmespath/visitor.py", line 66, in visit
return method(node, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/jmespath/visitor.py", line 114, in visit_comparator
self.visit(node['children'][0], value),
File "/usr/lib/python3.4/site-packages/jmespath/visitor.py", line 66, in visit
return method(node, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/jmespath/visitor.py", line 129, in visit_function_expression
return self._functions.call_function(node['value'], resolved_args)
File "/usr/lib/python3.4/site-packages/jmespath/functions.py", line 89, in call_function
self._validate_arguments(resolved_args, signature, function_name)
File "/usr/lib/python3.4/site-packages/jmespath/functions.py", line 100, in _validate_arguments
return self._type_check(args, signature, function_name)
File "/usr/lib/python3.4/site-packages/jmespath/functions.py", line 107, in _type_check
function_name)
File "/usr/lib/python3.4/site-packages/jmespath/functions.py", line 122, in _type_check_single
self._convert_to_jmespath_type(actual_typename), types)
jmespath.exceptions.JMESPathTypeError: In function length(), invalid type for value: None, expected one of: ['string', 'array', 'object'], received: "null"
Partial debug logging output (I wasn't sure if the log output could contain sensitive info, hopefully this portion is sufficient):
DEBUG:botocore.endpoint:Sending http request: <PreparedRequest [POST]>
INFO:botocore.vendored.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
DEBUG:botocore.vendored.requests.packages.urllib3.connectionpool:"POST / HTTP/1.1" 400 None
DEBUG:botocore.parsers:Response headers: {'nncoection': 'close', 'transfer-encoding': 'chunked', 'date': 'Tue, 03 May 2016 04:53:17 GMT', 'server': 'AmazonEC2'}
DEBUG:botocore.parsers:Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<Response><Errors><Error><Code>InvalidInstanceID.NotFound</Code><Message>The instance ID \'i-12345678\' does not exist</Message></Error></Errors><RequestID>67ae3003-e224-4a9e-b429-3d6b4d19ec6f</RequestID></Response>'
Code that reproduces the issue:
(Note that although this is an artificial example with an obviously-fake instance ID, the issue also reproduces occasionally with real instances if the waiter is called immediately after creating the instance.)
Output:
Partial debug logging output (I wasn't sure if the log output could contain sensitive info, hopefully this portion is sufficient):
I believe the problem is in this acceptor: https://github.com/boto/botocore/blob/develop/botocore/data/ec2/2015-10-01/waiters-2.json#L9
It was changed in 23fd477#diff-7c69e2e0de75f54556bb554dea557950; it used to only look at the response status rather than the response body.
Reverting that change to the JSON fixes the problem in my environment.
The text was updated successfully, but these errors were encountered: