From 6496c7735eb5b604794f492dd489fbddeecabd74 Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 4 Jul 2024 12:16:52 -0300 Subject: [PATCH 1/2] stop logging errors for api error responses From a cursory glance, when a real error occurs, we already log something at the application layer, so there's no reason to echo every api error response as an error log too. Errors should be actionable, but these logs were not, e.g.: > access denied to templates or: > category ID specified in input does not exist for user --- server/api/api.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/api/api.go b/server/api/api.go index 591db023dca..c8a64896d0f 100644 --- a/server/api/api.go +++ b/server/api/api.go @@ -178,7 +178,6 @@ func (a *API) userIsGuest(userID string) (bool, error) { // Response helpers func (a *API) errorResponse(w http.ResponseWriter, r *http.Request, err error) { - a.logger.Error(err.Error()) errorResponse := model.ErrorResponse{Error: err.Error()} switch { @@ -195,15 +194,16 @@ func (a *API) errorResponse(w http.ResponseWriter, r *http.Request, err error) { case model.IsErrNotImplemented(err): errorResponse.ErrorCode = http.StatusNotImplemented default: - a.logger.Error("API ERROR", - mlog.Int("code", http.StatusInternalServerError), - mlog.Err(err), - mlog.String("api", r.URL.Path), - ) errorResponse.Error = "internal server error" errorResponse.ErrorCode = http.StatusInternalServerError } + a.logger.Warn("api error response", + mlog.Int("code", http.StatusInternalServerError), + mlog.Err(err), + mlog.String("api", r.URL.Path), + ) + setResponseHeader(w, "Content-Type", "application/json") data, err := json.Marshal(errorResponse) if err != nil { From 49cc376efeddcbe8655738fc90b1b256ae9084f9 Mon Sep 17 00:00:00 2001 From: Rajat Dabade Date: Tue, 9 Jul 2024 10:22:56 +0530 Subject: [PATCH 2/2] chore: bumping up mysql docker image version --- docker-testing/docker-compose-mysql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-testing/docker-compose-mysql.yml b/docker-testing/docker-compose-mysql.yml index 60ea44aca92..111aacea210 100644 --- a/docker-testing/docker-compose-mysql.yml +++ b/docker-testing/docker-compose-mysql.yml @@ -1,7 +1,7 @@ version: '2.4' services: mysql: - image: "mysql/mysql-server:5.7.12" + image: "mysql/mysql-server:8.0.32" restart: always environment: MYSQL_ROOT_HOST: "%"