hatchet-dev / hatchet

A distributed, fault-tolerant task queue
https://hatchet.run
MIT License
4.3k stars 160 forks source link

bug: improve error message in event push #158

Open steebchen opened 9 months ago

steebchen commented 9 months ago

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

CroWzblooD commented 5 months ago

Is it available, I would like to work on this

steebchen commented 5 months ago

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

rdev99 commented 2 months ago

is this issue still open ?