New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 720119 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Bad buildbucket request got 200 status code back.

Project Member Reported by dgarr...@chromium.org, May 9 2017

Issue description

Requesting:
  url https://cr-buildbucket.appspot.com/_ah/api/buildbucket/v1/builds
  method PUT
  body
{"parameters_json": "{\"builder_name\": \"paladin\", \"properties\": {\"slaves_request\": [], \"extra_args\": [\"--remote-trybot\", \"--remote-version=4\"], \"cbb_extra_args\": [\"--remote-trybot\", \"--remote-version=4\"], \"version\": 4, \"name\": \"\", \"owners\": [\"dgarrett@google.com\"], \"bot\": [\"lumpy-paladin\"], \"email\": [\"dgarrett@google.com\"], \"cbb_config\": \"lumpy-paladin\", \"user\": \"dgarrett\"}}", "bucket": "luci.chromeos.general", "tags": ["build_type:tryjob"]}


Response:

{'content-length': '242', 'x-google-shellfish-status': 'CA0gBEBG', 'x-google-gfe-response-code-details-trace': 'response_code_set_by_backend', 'x-google-netmon-label': '/bns/in/borg/in/bns/apiserving-swarm/prod_swarm_api_frontend.server/2', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'x-google-backends': '/bns/in/borg/in/bns/apiserving-swarm/prod_swarm_api_frontend.server/2,acsfoi9:443', 'x-google-servertype': 'apiserving', 'etag': '"j4E8oID9kgOVF1aDvG2xIbsbVP4/gxBBWyStyS2BYAFdThs9hiUGvDI"', 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate', 'x-google-gfe-backend-request-info': 'eid=ZzcSWeDUA6SSqQP4xYvQAg', 'alt-svc': 'quic=":443"; ma=2592000; v="37,36,35"', 'x-google-gfe-service-trace': 'apiserving-swarm', 'status': '200', 'transfer-encoding': 'chunked', 'expires': 'Mon, 01 Jan 1990 00:00:00 GMT', '-content-encoding': 'gzip', 'pragma': 'no-cache', 'date': 'Tue, 09 May 2017 21:40:55 GMT', 'x-google-gfe-request-trace': 'acsfoi9:443,/bns/in/borg/in/bns/apiserving-swarm/prod_swarm_api_frontend.server/2,acsfoi9:443', 'x-google-dos-service-trace': 'main:apiserving-swarm', 'x-google-service': 'apiserving-swarm', 'server': 'GSE', 'x-google-gfe-response-body-transformations': 'chunked', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json; charset=UTF-8'}

Notice from above:
 'status': '200'


Content: {
 "error": {
  "message": "Builder u'paladin' is not defined in bucket u'luci.chromeos.general'",
  "reason": "INVALID_INPUT"
 },
 "kind": "buildbucket#resourcesItem",
 "etag": "\"j4E8oID9kgOVF1aDvG2xIbsbVP4/gxBBWyStyS2BYAFdThs9hiUGvDI\""
}



It's hard to decode it all, but I made a buildbucket request that scheduled against a builder that doesn't exist for a given buildbucket, and got back a 200 status code. That seems wrong.
 

Comment 1 by no...@chromium.org, May 9 2017

Status: WontFix (was: Untriaged)
Buildbucket uses Cloud Endpoint as an API framework which does not let return non-200 HTTP codes with arbitrary body. This is the reason why Buildbucket returns HTTP 200 with an an application-level error code in "reason" field.

This is working as intended.
Sigh. How anti-REST.
Cc: nxia@chromium.org
Is it safe to assume that all API requests will return JSON, and that the json will contain "error" on failure?

Comment 5 by no...@chromium.org, May 9 2017

yes, but the value of "error" may have different format. In HTTP 200 responses, the "error" is a JSON object with properties "reason" and "message". For all other responses, the "error" is a JSON object with properties "message", "code" and "errors". The latter is a list of JSON objects each having "reason" and "message".

so it is safe to assume that
- all responses are JSON
- all erroneous responses are JSON and have "message" field

Sign in to add a comment