lenra-io / server

GNU Affero General Public License v3.0
6 stars 0 forks source link

[Bug]: Some app's errors are treated as server errors #560

Open shiipou opened 6 months ago

shiipou commented 6 months ago

What happened?

As you can see on this sentry issue : https://lenra-br.sentry.io/issues/4984414382/?project=5633085

Some app errors are redirected to server as server's errors because of error in pattern matching in Elixir. We need to change that so this error will be redirected to the app and not to our server's notifications.

What browsers are you seeing the problem on?

No response

Version

1.5.3

Relevant log output

[__exception__: true, __struct__: LenraCommon.Errors.TechnicalError, message: "Internal server error.", metadata: "Access token is undefined or empty.\t\t\t\t\t\tPlease provide a valid token.\t\t\t\t\t\tFor more help - https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CustomAuthenticationProvider.md

\n\tlib/services/application_services.ex:380 Elixir.ApplicationRunner.ApplicationServices.response/2\n\tlib/services/application_services.ex:74 Elixir.ApplicationRunner.ApplicationServices.run_listener/5\n\tlib/event_handler.ex:105 Elixir.ApplicationRunner.EventHandler.handle_call/3\n\tgen_server.erl:721 gen_server.try_handle_call/4\n\tgen_server.erl:750 gen_server.handle_msg/6\n\tproc_lib.erl:226 proc_lib.init_p_do_apply/3", reason: :error_500, status_code: 500]
jonas-martinez commented 6 months ago

It seems that this error occurs when the application returns an error 500 on its side. What I mean by that is for the example used in this issue, the application tries to connect to msgraph but fails and msgraph returns a 500 error.

Then, the application sends this 500 back to the application_runner.

The problem with this, is that we cannot determine whether the application failed on our side or on the side of the app developer.

I don't really know how to handle this, I'm looking into it.

taorepoara commented 6 months ago

Might be linked to #563