Feedback API not validating forms

RESOLVED FIXED in 2013-04-11

Status

Marketplace
API
P1
normal
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: basta, Assigned: chuck)

Tracking

2013-04-11
Points:
---
Dependency tree / graph

Details

(Whiteboard: [fireplace])

(Reporter)

Description

5 years ago
{"error_message": "'platform'", "traceback": "Traceback (most recent call last):\n\n  File \"/Users/matt/.virtualenvs/zamboni/lib/python2.7/site-packages/tastypie/resources.py\", line 192, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/Users/matt/.virtualenvs/zamboni/lib/python2.7/site-packages/tastypie/resources.py\", line 397, in dispatch_list\n    return self.dispatch('list', request, **kwargs)\n\n  File \"/opt/zamboni/mkt/api/base.py\", line 49, in dispatch\n    .dispatch(request_type, request, **kwargs))\n\n  File \"/Users/matt/.virtualenvs/zamboni/lib/python2.7/site-packages/tastypie/resources.py\", line 427, in dispatch\n    response = method(request, **kwargs)\n\n  File \"/Users/matt/.virtualenvs/zamboni/lib/python2.7/site-packages/tastypie/resources.py\", line 1165, in post_list\n    updated_bundle = self.obj_create(bundle, request=request, **self.remove_api_resource_names(kwargs))\n\n  File \"/opt/zamboni/mkt/account/api.py\", line 165, in obj_create\n    bundle = self.full_hydrate(bundle)\n\n  File \"/Users/matt/.virtualenvs/zamboni/lib/python2.7/site-packages/tastypie/resources.py\", line 698, in full_hydrate\n    value = field_object.hydrate(bundle)\n\n  File \"/Users/matt/.virtualenvs/zamboni/lib/python2.7/site-packages/tastypie/fields.py\", line 154, in hydrate\n    elif self.attribute and getattr(bundle.obj, self.attribute, None):\n\n  File \"/opt/zamboni/mkt/api/base.py\", line 271, in __getattr__\n    return self.__getitem__(name)\n\nKeyError: 'platform'\n"}
(Assignee)

Updated

5 years ago
Assignee: nobody → charmston
Status: NEW → ASSIGNED
(Assignee)

Comment 1

5 years ago
Can I get repro details on this? Specifics about the request would be most helpful.
Flags: needinfo?(mattbasta)
(Reporter)

Comment 2

5 years ago
Request URL: /api/v1/account/feedback/?lang=en-US&region=internet&scr=wide&tch=false&dev=desktop&pro=3088.22.1&_user=<redacted>
Request Method:POST
Status Code:500 INTERNAL SERVER ERROR
Request Headers
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:79
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
DNT:1

Query String Parameters

lang:en-US
region:internet
scr:wide
tch:false
dev:desktop
pro:3088.22.1
_user:<redacted>

Form Data

feedback:test
sprout:potato
tuber:
chromeless:No
from_url:/
profile:3088.22.1

Response Headers

access-control-allow-headers:Content-Type
access-control-allow-methods:POST, OPTIONS
access-control-allow-origin:*
Content-Length:75
content-type:application/json; charset=utf-8
date:Tue, 09 Apr 2013 20:14:56 GMT
server:gunicorn/0.15.0
set-cookie:lang="en-US\054en-US"; Path=/, region=us; Path=/, multidb_pin_writes=y; expires=Tue, 09-Apr-2013 20:15:11 GMT; Max-Age=15; Path=/
strict-transport-security:max-age=2592000
vary:X-Requested-With, Accept-Language, Cookie, X-Mobile, User-Agent
via:Moz-pp-zlb09
x-api-version:1
x-content-security-policy-report-only:policy-uri /services/csp/policy?build=d9d9

Response

{"error_code": "KeyError", "error_data": {}, "error_message": "'platform'"}
Flags: needinfo?(mattbasta)
(Assignee)

Comment 3

5 years ago
Well, for starters, `platform` is required.

https://zamboni.readthedocs.org/en/latest/topics/api/misc.html#feedback

It should return a more helpful error message, though.
(Assignee)

Updated

5 years ago
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: p=1
Target Milestone: --- → 2013-04-11
(Reporter)

Comment 4

5 years ago
I'll separately go in and make it alternatively use the "dev" parameter that we're already passing, but it should definitely not return a 500.
(Assignee)

Updated

5 years ago
Summary: Feedback API tracebacking → Feedback API not validating forms
Whiteboard: p=1
Target Milestone: 2013-04-11 → ---
(Assignee)

Comment 5

5 years ago
Right. It should return a 400 with {"error_messages": {"platform": "This field is required"}}
(Assignee)

Comment 6

5 years ago
Turns out the field is actually optional, per `FeedbackForm`, and we weren't handling that appropriately.

Fix landed here: https://github.com/mozilla/zamboni/commit/9752f2b1f51d7660f68bafa4306d4f40f56ad892

Docs clarification: https://zamboni.readthedocs.org/en/latest/topics/api/misc.html#feedback
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2013-04-11
Whiteboard: [fireplace]
You need to log in before you can comment on or make changes to this bug.