thumbor-community / aws

Thumbor AWS extensions
MIT License
155 stars 70 forks source link

Load image file failed with aws loader #125

Closed zj8487 closed 6 years ago

zj8487 commented 6 years ago

Hello all, thanks for your contrubution.

I config the thumbor with the aws plugin to load image from aws , but it failed.

Stacktrace

tumbor_server    | 2018-09-13 08:14:10 thumbor:ERROR ERROR: Traceback (most recent call last):
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/thumbor/handlers/__init__.py", line 153, in get_image
tumbor_server    |     self.context.request.image_url
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/gen.py", line 1133, in run
tumbor_server    |     value = future.result()
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
tumbor_server    |     raise_exc_info(self._exc_info)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/gen.py", line 1141, in run
tumbor_server    |     yielded = self.gen.throw(*exc_info)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/thumbor/handlers/__init__.py", line 588, in _fetch
tumbor_server    |     loader_result = yield self.context.modules.loader.load(self.context, url)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/gen.py", line 1133, in run
tumbor_server    |     value = future.result()
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
tumbor_server    |     raise_exc_info(self._exc_info)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/stack_context.py", line 339, in wrapped
tumbor_server    |     ret = fn(*args, **kwargs)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/concurrent.py", line 569, in run_callback
tumbor_server    |     result = future.result()
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
tumbor_server    |     raise_exc_info(self._exc_info)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado/stack_context.py", line 339, in wrapped
tumbor_server    |     ret = fn(*args, **kwargs)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/tornado_botocore/base.py", line 138, in _process_response
tumbor_server    |     parsed = parser.parse(response_dict, operation_model.output_shape)
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/botocore/parsers.py", line 207, in parse
tumbor_server    |     if self._is_generic_error_response(response):
tumbor_server    |   File "/usr/local/lib/python2.7/site-packages/botocore/parsers.py", line 236, in _is_generic_error_response
tumbor_server    |     body = response['body'].strip()
tumbor_server    | AttributeError: 'NoneType' object has no attribute 'strip'
tumbor_server    | 
tumbor_server    | 2018-09-13 08:14:10 thumbor:ERROR [BaseHandler] get_image failed for url `mattermosts/aaa.jpg`. error: `'NoneType' object has no attribute 'strip'`
tumbor_server    | 2018-09-13 08:14:10 tornado.access:ERROR 500 GET /unsafe/mattermosts/aaa.jpg (192.168.176.1) 20010.58ms

Versions

/home/app # pip freeze
backports-abc==0.5
botocore==1.8.50
derpconf==0.8.2
docutils==0.14
futures==3.2.0
jmespath==0.9.3
libthumbor==1.3.2
piexif==1.0.13
Pillow==5.2.0
pycryptodome==3.6.6
pycurl==7.43.0.2
python-dateutil==2.7.3
pytz==2018.5
PyYAML==3.13
singledispatch==3.4.0.3
six==1.11.0
statsd==3.3.0
tc-aws==6.2.11
tc-core==0.4.1
tc-pdf==0.0.7
thumbor==6.5.2
thumbor-aliases==0.0.2
tornado==5.1
tornado-botocore==1.4.0
Wand==0.4.4
webcolors==1.8.1```

### Configuration for thumbor and tc_aws

```.ini
TC_AWS_REGION='us-east-1'
TC_AWS_ENDPOINT='http://192.168.32.104:19001'
TC_AWS_STORAGE_BUCKET=''
TC_AWS_STORAGE_ROOT_PATH=''
TC_AWS_LOADER_BUCKET=''
TC_AWS_LOADER_ROOT_PATH=''
TC_AWS_ENABLE_HTTP_LOADER=True
LOADER='tc_aws.loaders.s3_loader'

Configuration for boto credentials located in ~/.aws/credentials

[default]
aws_access_key_id=minio
aws_secret_access_key=minio1234

Configuration for boto config located in ~/.aws/config

[default]
region=us-east-1
output=text # json is tested also
zj8487 commented 6 years ago

change the botocore==1.8.1 to botocore==1.4.0 and it works BWT, i use minio as the aws backend.

dominik-bln commented 5 years ago

We're encountering the same problem with AWS, I'll try the downgrade, but might be good to reopen.

Bladrak commented 5 years ago

Might be related to tornado_botocore issue (see commit: https://github.com/thumbor-community/aws/commit/07f0c0901ad0ae87926c55314a2dcffe0dec29ac)