Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

API: Get Event returns HTTP 500 when event cant be found. Should be 404 #1655

Closed
grabnerandi opened this issue Apr 20, 2020 · 3 comments · Fixed by #2114 or #2191
Closed

API: Get Event returns HTTP 500 when event cant be found. Should be 404 #1655

grabnerandi opened this issue Apr 20, 2020 · 3 comments · Fixed by #2114 or #2191
Assignees
Labels
area:api good first issue Issues for getting started developing Keptn type:bug Something is not working as intended/documented type:chore Provides value to the (dev) team
Milestone

Comments

@grabnerandi
Copy link
Member

When waiting for an evaluation-done event a client has to call GET /event with the keptnContext and evaluation-done as event type. When the event does not yet exists the Keptn API returns an HTTP 500 (Internal Server Error) instead of something that is more descriptive, e.g: 404 Resource Not Found.

HTTP 500 is definitely misleading as this is not an internal server error. It is really about an event not being present - so - a more suitable HTTP Status Code should be used, e.g: 404

@johannes-b johannes-b added area:api type:chore Provides value to the (dev) team labels May 7, 2020
@stale
Copy link

stale bot commented Jul 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 6, 2020
@agrimmer agrimmer added the good first issue Issues for getting started developing Keptn label Jul 8, 2020
@stale stale bot removed the stale label Jul 8, 2020
@johannes-b johannes-b added this to the 0.8.0 milestone Jul 16, 2020
@johannes-b johannes-b added this to Backlog in Working items via automation Jul 16, 2020
@imrenagi
Copy link
Contributor

I will take this

@johannes-b johannes-b moved this from Backlog to Assigned and committed in Working items Jul 22, 2020
@johannes-b johannes-b linked a pull request Jul 28, 2020 that will close this issue
@johannes-b johannes-b moved this from Assigned and committed to In progress in Working items Jul 28, 2020
@agrimmer agrimmer reopened this Jul 28, 2020
@johannes-b johannes-b added type:bug Something is not working as intended/documented next-sprint Items that should be discussed and implemented in the next sprint labels Aug 3, 2020
@johannes-b
Copy link
Member

johannes-b commented Aug 4, 2020

The /GET event endpoint still returns a 500 - Internal Server error, because the GetEvent function returns an error which leads to the 500 error.

Task:

  • Change the getLatestEvent (in mongodb-datastore) to return a 404 when no event with the given keptnContext and type is available

Definition of Done:

  • The /GET event endpoint returns 404 (resource not found) when the event from the given keptnContext and type is not available.

@johannes-b johannes-b modified the milestones: 0.8.0, 0.7.1 Aug 5, 2020
@johannes-b johannes-b moved this from In progress to Backlog in Working items Aug 5, 2020
@johannes-b johannes-b moved this from Backlog to Assigned and committed in Working items Aug 6, 2020
@johannes-b johannes-b removed the next-sprint Items that should be discussed and implemented in the next sprint label Aug 7, 2020
@bacherfl bacherfl moved this from Assigned and committed to In progress in Working items Aug 7, 2020
bacherfl added a commit that referenced this issue Aug 10, 2020
bacherfl added a commit that referenced this issue Aug 11, 2020
@bacherfl bacherfl moved this from In progress to Ready for review in Working items Aug 11, 2020
bacherfl added a commit that referenced this issue Aug 11, 2020
* #1655 return nil instead of error if no event has been found

* #1655 return nil instead of error if no event has been found

* #1655 return 404 instead of 500 if no event could be found

* #1655 update dependency

* #1655 updated go-utils
@johannes-b johannes-b moved this from Ready for review to Done/presented in community review (column will be cleaned regularly) in Working items Aug 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:api good first issue Issues for getting started developing Keptn type:bug Something is not working as intended/documented type:chore Provides value to the (dev) team
Projects
No open projects
Working items
Done/presented in community review (c...
5 participants