hatchet icon indicating copy to clipboard operation
hatchet copied to clipboard

bug: improve error message in event push

Open steebchen opened this issue 2 years ago • 3 comments

This should return forbidden only when the query can't find the tenant or the authentication is wrong. Otherwise, the error message should be different and an internal or unavailable error should be returned. This can happen when the database query returns an error (e.g. due to it being unavailable).

https://github.com/hatchet-dev/hatchet/blob/78685d0098123178f600b646ae21bd47bc138802/internal/services/grpc/middleware/auth.go#L37-L51

An important part is this line

https://github.com/hatchet-dev/hatchet/blob/73adb7791eba9a923c6d7735d2fc93df7c0c8d32/internal/auth/token/token.go#L145

as this needs to be checked for a NotFound error, and then it should return a forbidden error if something is off with the jwt, and in all other cases a generic error with a 500 status code

steebchen avatar Feb 06 '24 17:02 steebchen

Is it available, I would like to work on this

ImAshishChoudhary avatar Jun 26 '24 04:06 ImAshishChoudhary

sure, ideally it is solved with the errors package and then checking for errors.Is(...)

steebchen avatar Jun 26 '24 13:06 steebchen