ocket8888 opened a new issue #5014:
URL: https://github.com/apache/trafficcontrol/issues/5014
## I'm submitting a ...
- bug report
## Traffic Control components affected ...
- Traffic Ops
## Current behavior:
Because of the way workflow transitions are verified, creating a DSR with
any non-null value in the `id` property will cause the request to fail. If `id`
was an integer, though, it will give back the error-level alert: `sql: no rows
in result set`, which is both cryptic and - looking at the code - unnecessary.
## Expected / new behavior:
If IDs have special meaning to requests, they should be documented - but
it's more likely that the intended behaviour is just to ignore the ID, since it
can't reasonably be known before the object is created.
## Minimal reproduction of the problem with instructions:
Submit a POST request to `/deliveryservice_requests` with an integral ID
value. The simplest request body to reproduce the error is just `{"id": -1}`
(which should work regardless of extant data).
## Anything else:
<details>
<summary>Full HTTP Stack</summary>
```http
POST /api/2.0/deliveryservice_requests HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie:
mojolicious=eyJhdXRoX2RhdGEiOiJhZG1pbiIsImV4cGlyZXMiOjE1OTkxOTI1ODIsImJ5IjoidHJhZmZpY2NvbnRyb2wtZ28tdG9jb29raWUifQ--2d0e7a169ef17f538d58830ee8451e2113562119
Content-Length: 9
{"id": 2}
```
```http
HTTP/1.1 400 Bad Request
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type,
Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie:
mojolicious=eyJhdXRoX2RhdGEiOiJhZG1pbiIsImV4cGlyZXMiOjE1OTkxNzQ1ODIsImJ5IjoidHJhZmZpY2NvbnRyb2wtZ28tdG9jb29raWUifQ--88ac7381f3f3d92bb3fd8dc8975be3896a2acc3d;
Path=/; Expires=Thu, 03 Sep 2020 23:09:42 GMT; Max-Age=3600; HttpOnly
Vary: Accept-Encoding
Whole-Content-Sha512:
kLdrEUgBgalHQ/z01sSUnd5k/TCwjNOnjY6tZWxY88JIhEsiOPoACLxUIGPad+ErIRJ+l2mpC5g8/89l34o0jA==
X-Server-Name: traffic_ops_golang/
Date: Thu, 03 Sep 2020 22:09:42 GMT
Content-Length: 88
{
"alerts": [
{
"text": "sql: no rows in result set",
"level": "error"
}
]
}
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]