/new_data/feedback TypeError: the JSON object must be str, bytes or bytearray, not dict
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in flask_api.py at save_feedback around line 239 and inspect how request.get_json() is passed to json.loads(). Reproduce the POST to /new_data/feedback with the payload that triggered the stack trace; done means valid JSON requests no longer raise this TypeError or return HTTP 500.
Written by the indexing model from the issue text.
Description
Stacktrace
May 28 09:44:03 AM 10.100.0.191 - - [28/May/2020:16:44:03 +0000] "GET / HTTP/1.1" 200 37 "-" "Render/1.0"
May 28 09:44:08 AM 10.104.30.4 - - [28/May/2020:16:44:08 +0000] "OPTIONS /new_data/feedback HTTP/1.1" 200 0 "https://nimbus.calpolycsai.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
May 28 09:44:08 AM [2020-05-28 16:44:08,122] ERROR in app: Exception on /new_data/feedback [POST]
May 28 09:44:08 AM Traceback (most recent call last):
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/render/project/src/.venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/render/project/src/flask_api.py", line 239, in save_feedback
data = json.loads(request.get_json())
File "/usr/local/lib/python3.7/json/__init__.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not dict
May 28 09:44:08 AM 10.104.30.4 - - [28/May/2020:16:44:08 +0000] "POST /new_data/feedback HTTP/1.1" 500 290 "https://nimbus.calpolycsai.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
- Dominant language
- Python
- Stars
- 9
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from calpoly-csai/api
-
documentation enhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
calpoly-csai/api#190 · 8 comments ·
-
enhancement
calpoly-csai/api#181 · 1 assignee ·
-
bug
Difficulty 5/5 Over a week Newbie friendliness 25/100
calpoly-csai/api#179 · 4 comments ·
-
enhancement
calpoly-csai/api#174 · 3 comments · 5 assignees ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 38/100
calpoly-csai/api#159 · 1 comment ·
All issues in calpoly-csai/api
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100