Unknown Error
Closed this issue · 5 comments
lucacastelnuovo commented
Hi, I'm have just installed imgpush behind an nginx reverse proxy.
The /liveness
endpoint works.
But if I upload an image using the form on /
I'm getting the following error.
Could you help me solve this?
[2020-08-12 20:32:27,875] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.6/site-packages/flask_limiter/extension.py", line 544, in __inner
return obj(*a, **k)
File "/app/app.py", line 153, in upload_image
if "file" not in request.files:
File "/usr/local/lib/python3.6/site-packages/werkzeug/local.py", line 348, in __getattr__
return getattr(self._get_current_object(), name)
File "/usr/local/lib/python3.6/site-packages/werkzeug/utils.py", line 90, in __get__
value = self.func(obj)
File "/usr/local/lib/python3.6/site-packages/werkzeug/wrappers/base_request.py", line 513, in files
self._load_form_data()
File "/usr/local/lib/python3.6/site-packages/flask/wrappers.py", line 88, in _load_form_data
RequestBase._load_form_data(self)
File "/usr/local/lib/python3.6/site-packages/werkzeug/wrappers/base_request.py", line 318, in _load_form_data
self._get_stream_for_parsing(), mimetype, content_length, options
File "/usr/local/lib/python3.6/site-packages/werkzeug/formparser.py", line 223, in parse
and content_length > self.max_content_length
TypeError: '>' not supported between instances of 'int' and 'str'
190.13.124.154 - - [12/Aug/2020:20:32:27 +0000] "POST / HTTP/1.0" 500 290 "https://assets.castelnuovo.xyz/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
hauxir commented
Can you share a bit more details on how you installed it?
lucacastelnuovo commented
I installed it by cloning the repo, and running docker-compose up
This is my docker-compose.yml.
version: "3.5"
services:
imgpush:
ports:
- "80:5000"
build: .
environment:
- MAX_SIZE_MB="16"
- MAX_UPLOADS_PER_DAY="1000"
- MAX_UPLOADS_PER_HOUR="100"
- MAX_UPLOADS_PER_MINUTE="20"
- ALLOWED_ORIGINS="['https://a.com', 'https://b.com']"
- VALID_SIZES="[100,200,300]"
- NAME_STRATEGY="uuidv4"
volumes:
- ./app:/app
- ./images:/images
- ./cache:/cache
healthcheck:
start_period: 0s
test:
[
"CMD-SHELL",
"curl localhost:5000/liveness -s -f -o /dev/null || exit 1",
]
interval: 30s
lucacastelnuovo commented
I have found the error, I believe.
If I disable the MAX_SIZE_MB
config var it works.
hauxir commented
try leaving out the quotes
lucacastelnuovo commented
Yes that fixed the error.