This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 355
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Internal Server Error when assigning a non-existent DSR #5033
Copy link
Copy link
Closed
Labels
Traffic Opsrelated to Traffic Opsrelated to Traffic Opsbugsomething isn't working as intendedsomething isn't working as intendedlow impactaffects only a small portion of a CDN, and cannot itself break oneaffects only a small portion of a CDN, and cannot itself break one
Description
I'm submitting a ...
- bug report
Traffic Control components affected ...
- Traffic Ops
Current behavior:
Trying to assign a Delivery Service Request which does not exist to any user will result in an Internal Server error.
Expected / new behavior:
If a resource is not found, the API should communicate that with the 404 Not Found HTTP status code.
Minimal reproduction of the problem with instructions:
Given that no Delivery Service Request exists with the ID 1, attempt to assign Delivery Service Request 1 to any (existing) user. I used my own user (who had the ID 9 in the following example) and it looks like this:
Request
PUT /api/2.0/deliveryservice_requests/1/assign HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: mojolicious=...
Content-Length: 15
{"assigneeId": 9}(Note also that the documentation specifies a required "id" property of the request body - that is not correct. The DSR to be assigned is fully identified by the request URI.)
Response
HTTP/1.1 500 Internal Server Error
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=...
Vary: Accept-Encoding
X-Server-Name: traffic_ops_golang/
Date: Tue, 15 Sep 2020 23:34:43 GMT
Content-Length: 83
{
"alerts": [
{
"text": "Internal Server Error",
"level": "error"
}
]
}Anything else:
From the stack trace I found:
INFO: routing.go:249: 2020-09-15T23:26:42.644209507Z: PUT /api/2.0/deliveryservice_requests/1/assign? handling (reqid 33624)
DEBUG: plugin.go:190: 2020-09-15T23:26:42.644259514Z: DEBUG plugins.OnRequest calling 0 plugins
ERROR: api.go:209: 2020-09-15T23:26:42.651463829Z: 172.20.0.1:47534 dsr assignment querying existing: sql: no rows in result set
DEBUG: api.go:214: 2020-09-15T23:26:42.651514639Z: Internal Server Error
172.20.0.1:47534 - admin [15/Sep/2020:23:26:42 +0000] "PUT /api/2.0/deliveryservice_requests/1/assign? HTTP/1.1" 500 83 7 "python-requests/2.22.0" 2703160290 NON_IMS
INFO: routing.go:252: 2020-09-15T23:26:42.652031369Z: PUT /api/2.0/deliveryservice_requests/1/assign? handled (reqid 33624) in 7.774269ms
which suggests that a database/sql.ErrNoRows isn't being handled somewhere.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Traffic Opsrelated to Traffic Opsrelated to Traffic Opsbugsomething isn't working as intendedsomething isn't working as intendedlow impactaffects only a small portion of a CDN, and cannot itself break oneaffects only a small portion of a CDN, and cannot itself break one