mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
Include transformed request in errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2543 Co-authored-by: Solomon Bothwell <24038+ssbothwell@users.noreply.github.com> GitOrigin-RevId: 1432a215cfc2c3e8345941b8072925f115f9259f
This commit is contained in:
parent
1d719eb811
commit
788e5cb0c2
@ -13,6 +13,7 @@ suffix-less versions. Aliases may be set by both
|
|||||||
|
|
||||||
### Bug fixes and improvements
|
### Bug fixes and improvements
|
||||||
|
|
||||||
|
- server: add transformed request to action error responses
|
||||||
- server: allow nullable action responses (#4405)
|
- server: allow nullable action responses (#4405)
|
||||||
- server: add support for openapi json of REST Endpoints
|
- server: add support for openapi json of REST Endpoints
|
||||||
- server: enable inherited roles by default in the graphql-engine
|
- server: enable inherited roles by default in the graphql-engine
|
||||||
|
@ -503,13 +503,14 @@ callWebhook
|
|||||||
let transformedPayloadSize = HTTP.getReqSize transformedReq
|
let transformedPayloadSize = HTTP.getReqSize transformedReq
|
||||||
in pure (Just transformedReq, Just transformedPayloadSize)
|
in pure (Just transformedReq, Just transformedPayloadSize)
|
||||||
|
|
||||||
|
let actualReq = fromMaybe req transformedReq
|
||||||
|
|
||||||
httpResponse <-
|
httpResponse <-
|
||||||
Tracing.tracedHttpRequest (fromMaybe req transformedReq) $ \request ->
|
Tracing.tracedHttpRequest actualReq $ \request ->
|
||||||
liftIO . try $ HTTP.performRequest request manager
|
liftIO . try $ HTTP.performRequest request manager
|
||||||
|
|
||||||
let requestInfo =
|
let requestInfo = ActionRequestInfo url postPayload (confHeaders <> toHeadersConf clientHeaders) transformedReq
|
||||||
ActionRequestInfo url postPayload $
|
|
||||||
confHeaders <> toHeadersConf clientHeaders
|
|
||||||
case httpResponse of
|
case httpResponse of
|
||||||
Left e ->
|
Left e ->
|
||||||
throw500WithDetail "http exception when calling webhook" $
|
throw500WithDetail "http exception when calling webhook" $
|
||||||
|
@ -98,9 +98,10 @@ instance J.ToJSON ActionWebhookResponse where
|
|||||||
data ActionRequestInfo = ActionRequestInfo
|
data ActionRequestInfo = ActionRequestInfo
|
||||||
{ _areqiUrl :: !Text,
|
{ _areqiUrl :: !Text,
|
||||||
_areqiBody :: !J.Value,
|
_areqiBody :: !J.Value,
|
||||||
_areqiHeaders :: ![HeaderConf]
|
_areqiHeaders :: ![HeaderConf],
|
||||||
|
_areqiTransformedRequest :: !(Maybe HTTP.Request)
|
||||||
}
|
}
|
||||||
deriving (Show, Eq)
|
deriving (Show)
|
||||||
|
|
||||||
$(J.deriveToJSON (J.aesonDrop 6 J.snakeCase) ''ActionRequestInfo)
|
$(J.deriveToJSON (J.aesonDrop 6 J.snakeCase) ''ActionRequestInfo)
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ data ActionInternalError = ActionInternalError
|
|||||||
_aieRequest :: !ActionRequestInfo,
|
_aieRequest :: !ActionRequestInfo,
|
||||||
_aieResponse :: !(Maybe ActionResponseInfo)
|
_aieResponse :: !(Maybe ActionResponseInfo)
|
||||||
}
|
}
|
||||||
deriving (Show, Eq)
|
deriving (Show)
|
||||||
|
|
||||||
$(J.deriveToJSON (J.aesonDrop 4 J.snakeCase) ''ActionInternalError)
|
$(J.deriveToJSON (J.aesonDrop 4 J.snakeCase) ''ActionInternalError)
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
\ }\n }\n}\n"
|
\ }\n }\n}\n"
|
||||||
url: http://127.0.0.1:5593/create-user
|
url: http://127.0.0.1:5593/create-user
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: unexpected
|
code: unexpected
|
||||||
message: expecting array for action webhook response but got object
|
message: expecting array for action webhook response but got object
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
\ id\n }\n}\n"
|
\ id\n }\n}\n"
|
||||||
url: http://127.0.0.1:5593/null-response
|
url: http://127.0.0.1:5593/null-response
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: unexpected
|
code: unexpected
|
||||||
message: expecting array for action webhook response but got null
|
message: expecting array for action webhook response but got null
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
\ }\n}\n"
|
\ }\n}\n"
|
||||||
url: http://127.0.0.1:5593/create-users
|
url: http://127.0.0.1:5593/create-users
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: unexpected
|
code: unexpected
|
||||||
message: expecting object for action webhook response but got array
|
message: expecting object for action webhook response but got array
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
request_query: "mutation {\n create_user {\n id\n }\n}\n"
|
request_query: "mutation {\n create_user {\n id\n }\n}\n"
|
||||||
url: http://127.0.0.1:5593/null-response
|
url: http://127.0.0.1:5593/null-response
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: unexpected
|
code: unexpected
|
||||||
message: expecting object for action webhook response but got null
|
message: expecting object for action webhook response but got null
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
\ }\n }\n}\n"
|
\ }\n }\n}\n"
|
||||||
url: http://127.0.0.1:5593/invalid-response
|
url: http://127.0.0.1:5593/invalid-response
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: parse-failed
|
code: parse-failed
|
||||||
message: expecting null, object or array of objects for action webhook response
|
message: expecting null, object or array of objects for action webhook response
|
||||||
|
@ -28,6 +28,7 @@ response:
|
|||||||
\ id\n name\n }\n}\n"
|
\ id\n name\n }\n}\n"
|
||||||
url: http://127.0.0.1:5593/mirror-action
|
url: http://127.0.0.1:5593/mirror-action
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: unexpected
|
code: unexpected
|
||||||
message: field "id" expected in webhook response, but not found
|
message: field "id" expected in webhook response, but not found
|
||||||
|
@ -30,6 +30,7 @@ response:
|
|||||||
\ $name}){\n id\n name\n }\n}\n"
|
\ $name}){\n id\n name\n }\n}\n"
|
||||||
url: http://127.0.0.1:5593/mirror-action
|
url: http://127.0.0.1:5593/mirror-action
|
||||||
headers: []
|
headers: []
|
||||||
|
transformed_request:
|
||||||
path: $
|
path: $
|
||||||
code: unexpected
|
code: unexpected
|
||||||
message: expecting not null value for field "id"
|
message: expecting not null value for field "id"
|
||||||
|
Loading…
Reference in New Issue
Block a user