Laixer / Swabbr-Backend

API backend for the Swabbr application.
2 stars 0 forks source link

Follow request trigger function. Do we even want this? #246

Open tabeckers opened 3 years ago

tabeckers commented 3 years ago

application.user.user_follow_mode_change_auto_update trigger gives an exception in some cases.

tabeckers commented 3 years ago

swabbr-backend-staging | 2021-03-09 14:14:42       An unhandled exception has occurred while executing the request.
swabbr-backend-staging | 2021-03-09 14:14:42       Npgsql.PostgresException (0x80004005): 23502: null value in column "follow_request_status" violates not-null constraint
swabbr-backend-staging | 2021-03-09 14:14:42          at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
swabbr-backend-staging | 2021-03-09 14:14:42          at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
swabbr-backend-staging | 2021-03-09 14:14:42          at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
swabbr-backend-staging | 2021-03-09 14:14:42          at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
swabbr-backend-staging | 2021-03-09 14:14:42          at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Database.DatabaseContext.NonQueryAsync(Boolean hasRowGuard) in /source/Swabbr.Infrastructure/Database/DatabaseContext.cs:line 233
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Providers.DatabaseProvider.HandleException(ExceptionDispatchInfo edi) in /source/Swabbr.Infrastructure/Providers/DatabaseProvider.cs:line 70
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Providers.NpgsqlDatabaseProvider.HandleException(ExceptionDispatchInfo edi) in /source/Swabbr.Infrastructure/Providers/NpgsqlDatabaseProvider.cs:line 78
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Database.DatabaseContext.HandleException(ExceptionDispatchInfo edi) in /source/Swabbr.Infrastructure/Database/DatabaseContext.cs:line 81
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Database.DatabaseContext.NonQueryAsync(Boolean hasRowGuard) in /source/Swabbr.Infrastructure/Database/DatabaseContext.cs:line 233
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Repositories.UserRepository.UpdateAsync(User entity) in /source/Swabbr.Infrastructure/Repositories/UserRepository.cs:line 567
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Infrastructure.Repositories.UserRepository.UpdateAsync(User entity) in /source/Swabbr.Infrastructure/Repositories/UserRepository.cs:line 567
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Api.Helpers.UserUpdateHelper.UpdateUserAsync(UserUpdateDto input) in /source/Swabbr.Api/Helpers/UserUpdateHelper.cs:line 94
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Api.Controllers.UserController.UpdateAsync(UserUpdateDto input) in /source/Swabbr.Api/Controllers/UserController.cs:line 207
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.Invoke(HttpContext context)
swabbr-backend-staging | 2021-03-09 14:14:42          at Swabbr.Api.ErrorMessaging.ExceptionHandlerMiddleware`1.ProcessAsync(HttpContext context, Task task) in /source/Swabbr.Api/ErrorMessaging/ExceptionHandlerMiddleware.cs:line 106
swabbr-backend-staging | 2021-03-09 14:14:42          at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
swabbr-backend-staging | 2021-03-09 14:14:42         Exception data:
swabbr-backend-staging | 2021-03-09 14:14:42           Severity: ERROR
swabbr-backend-staging | 2021-03-09 14:14:42           SqlState: 23502
swabbr-backend-staging | 2021-03-09 14:14:42           MessageText: null value in column "follow_request_status" violates not-null constraint
swabbr-backend-staging | 2021-03-09 14:14:42           Detail: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
swabbr-backend-staging | 2021-03-09 14:14:42           Where: SQL statement "update application.follow_request
swabbr-backend-staging | 2021-03-09 14:14:42            set follow_request_status = case 
swabbr-backend-staging | 2021-03-09 14:14:42                    when new.follow_mode = 'accept_all' then 'accepted'::application.follow_request_status
swabbr-backend-staging | 2021-03-09 14:14:42                    when new.follow_mode = 'decline_all' then 'declined'::application.follow_request_status
swabbr-backend-staging | 2021-03-09 14:14:42                    end
swabbr-backend-staging | 2021-03-09 14:14:42            WHERE receiver_id = NEW.id
swabbr-backend-staging | 2021-03-09 14:14:42            and follow_request_status = 'pending'::application.follow_request_status"
swabbr-backend-staging | 2021-03-09 14:14:42       PL/pgSQL function application.user_follow_mode_change_auto_update() line 3 at SQL statement
swabbr-backend-staging | 2021-03-09 14:14:42           SchemaName: application
swabbr-backend-staging | 2021-03-09 14:14:42           TableName: follow_request
swabbr-backend-staging | 2021-03-09 14:14:42           ColumnName: follow_request_status
swabbr-backend-staging | 2021-03-09 14:14:42           File: execMain.c
swabbr-backend-staging | 2021-03-09 14:14:42           Line: 1948
swabbr-backend-staging | 2021-03-09 14:14:42           Routine: ExecConstraints
swabbr-backend-staging | 2021-03-09 14:14:42 warn: Swabbr.Api.Controllers.ErrorController[0]
swabbr-backend-staging | 2021-03-09 14:14:42       Cannot return configured error message from exception, return generic problem```
tabeckers commented 3 years ago

The trigger has been disabled until further notice.