mapseed/platform

Cannot upload attachments to s3 bucket when using multi-datasets

Closed this issue · 2 comments

Here is the error on the api:

----------------------------------------
[19/Aug/2016 07:12:49] "GET /api/v2/smartercleanup/datasets/duwamish/actions HTTP/1.1" 200 19628
[19/Aug/2016 07:15:11] code 400, message Bad HTTP/0.9 request type ("\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03\xd0i\x16_'N\xea64\x01\x1a\xe1O\xbc\xc5\xa2-\xee!\xbdjZEo\x7f\xe9h")
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 45668)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/SocketServer.py", line 596, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib64/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/lucas/.virtualenvs/smartercleanup-api/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/lib64/python2.7/SocketServer.py", line 652, in __init__
    self.handle()
  File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 124, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "/usr/lib64/python2.7/BaseHTTPServer.py", line 281, in parse_request
    "Bad HTTP/0.9 request type (%r)" % command)
  File "/usr/lib64/python2.7/BaseHTTPServer.py", line 365, in send_error
    self.send_response(code, message)
  File "/usr/lib64/python2.7/BaseHTTPServer.py", line 396, in send_response
    self.log_request(code)
  File "/usr/lib64/python2.7/BaseHTTPServer.py", line 433, in log_request
    self.requestline, str(code), str(size))
  File "/home/lucas/.virtualenvs/smartercleanup-api/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 9: ordinal not in range(128)
----------------------------------------

We should push this fix to our develop-0.7.0 branch

We don't get this error on master, only on the branches with multi datasets

@Lukeswart could this be http/https related? Just googling the error above I'm finding a few mentions of problems caused when trying to access an http site over https. Do the image attachments get sent over https maybe, causing an issue with the local http installation of the api?

http://stackoverflow.com/questions/18940441/strange-unicodedecodeerror-on-django

Ah, thanks for the input! Yes, that could be, since our local api is not on https (but the dev and prod api's are).

We may want to look into a better solution that "fakes" s3 and saves the attachments onto your local filesystem when no in production mode