ericholguin opened a new issue, #6828: URL: https://github.com/apache/trafficcontrol/issues/6828
<!-- ************ STOP!! ************ If this issue identifies a security vulnerability, DO NOT submit it! Instead, contact the Apache Traffic Control Security Team at [email protected] and follow the guidelines at https://apache.org/security regarding vulnerability disclosure. - For *SUPPORT QUESTIONS*, use the #traffic-control channel on the ASF slack (https://s.apache.org/tc-slack-request) or the Traffic Control Users mailing list (send an email to [email protected] to subscribe). - Before submitting, please **SEARCH GITHUB** for a similar issue or PR * https://github.com/apache/trafficcontrol/issues * https://github.com/apache/trafficcontrol/pulls --> <!-- Do not submit security vulnerabilities or support requests here - see above --> ## This Bug Report affects these Traffic Control components: <!-- delete all those that don't apply --> - Traffic Ops ## Current behavior: <!-- Describe how the bug happens --> When updating a server without the `id` key in the request body it will result in an Internal Server Error. Previously a user could update a server without needing the `id` in the request body. ```http HTTP/1.1 500 Internal Server Error { "alerts": [ { "text": "Internal Server Error", "level": "error" } ] } ``` ## Expected behavior: <!-- Describe what the behavior would be without the bug --> Should not create the server and return: ```http HTTP/1.1 200 OK { "alerts": [ { "text": "Server updated", "level": "success" } ], "response": {...} } ``` ## Steps to reproduce: <!-- If the current behavior is a bug, please provide the *STEPS TO REPRODUCE* and include the applicable TC version. --> Make a `PUT` request to `/api/4.0/servers` without the `id` in the request body this will result in an Internal Server Error. Do the same request but add the `id` key in the request body and it should return a 200 OK ## Comments: Error.log: ``` ERROR: api.go:263: 2022-05-12T20:27:54.27204231Z: 172.20.0.11:57930 panic: (err: runtime error: invalid memory address or nil pointer dereference) stacktrace: goroutine 39931 [running]: github.com/apache/trafficcontrol/lib/go-util.Stacktrace() /tmp/go/src/github.com/apache/trafficcontrol/lib/go-util/util.go:32 +0x66 github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1.1() /tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:173 +0x66 panic({0xd164c0, 0x1506330}) /usr/local/go/src/runtime/panic.go:838 +0x207 github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/server.Update({0xfa4850, 0xc0062629c0}, 0xc006240a00) /tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/server/servers.go:1496 +0xf57 ``` -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
