diff --git a/internal/servers/controller/gateway.go b/internal/servers/controller/gateway.go index 397486684..05243cb07 100644 --- a/internal/servers/controller/gateway.go +++ b/internal/servers/controller/gateway.go @@ -75,9 +75,9 @@ func newGrpcServer( grpc.UnaryInterceptor( grpc_middleware.ChainUnaryServer( requestCtxInterceptor, // populated requestInfo from headers into the request ctx + errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy subtypes.AttributeTransformerInterceptor(ctx), // convert to/from generic attributes from/to subtype specific attributes auditRequestInterceptor(ctx), // before we get started, audit the request - errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy statusCodeInterceptor(ctx), // convert grpc codes into http status codes for the http proxy (can modify the resp) auditResponseInterceptor(ctx), // as we finish, audit the response grpc_recovery.UnaryServerInterceptor( // recover from panics with a grpc internal error diff --git a/internal/tests/api/accounts/account_test.go b/internal/tests/api/accounts/account_test.go index 671d0af8c..1c4f9197a 100644 --- a/internal/tests/api/accounts/account_test.go +++ b/internal/tests/api/accounts/account_test.go @@ -382,4 +382,12 @@ func TestErrorsOidc(t *testing.T) { apiErr = api.AsServerError(err) require.NotNil(apiErr) assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode()) + + // Invalid attribute fields + _, err = accountClient.Create(tc.Context(), amId, + accounts.WithOidcAccountSubject("subject2"), + accounts.WithPasswordAccountLoginName("foo"), + ) + require.Error(err) + require.JSONEq(err.Error(), `{"kind":"InvalidArgument", "message":"Error in provided request.", "details":{"request_fields":[{"name":"attributes", "description":"Attribute fields do not match the expected format."}]}}`) }