mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +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
|
||||
|
||||
- server: add transformed request to action error responses
|
||||
- server: allow nullable action responses (#4405)
|
||||
- server: add support for openapi json of REST Endpoints
|
||||
- server: enable inherited roles by default in the graphql-engine
|
||||
|
@ -503,13 +503,14 @@ callWebhook
|
||||
let transformedPayloadSize = HTTP.getReqSize transformedReq
|
||||
in pure (Just transformedReq, Just transformedPayloadSize)
|
||||
|
||||
let actualReq = fromMaybe req transformedReq
|
||||
|
||||
httpResponse <-
|
||||
Tracing.tracedHttpRequest (fromMaybe req transformedReq) $ \request ->
|
||||
Tracing.tracedHttpRequest actualReq $ \request ->
|
||||
liftIO . try $ HTTP.performRequest request manager
|
||||
|
||||
let requestInfo =
|
||||
ActionRequestInfo url postPayload $
|
||||
confHeaders <> toHeadersConf clientHeaders
|
||||
let requestInfo = ActionRequestInfo url postPayload (confHeaders <> toHeadersConf clientHeaders) transformedReq
|
||||
|
||||
case httpResponse of
|
||||
Left e ->
|
||||
throw500WithDetail "http exception when calling webhook" $
|
||||
|
@ -98,9 +98,10 @@ instance J.ToJSON ActionWebhookResponse where
|
||||
data ActionRequestInfo = ActionRequestInfo
|
||||
{ _areqiUrl :: !Text,
|
||||
_areqiBody :: !J.Value,
|
||||
_areqiHeaders :: ![HeaderConf]
|
||||
_areqiHeaders :: ![HeaderConf],
|
||||
_areqiTransformedRequest :: !(Maybe HTTP.Request)
|
||||
}
|
||||
deriving (Show, Eq)
|
||||
deriving (Show)
|
||||
|
||||
$(J.deriveToJSON (J.aesonDrop 6 J.snakeCase) ''ActionRequestInfo)
|
||||
|
||||
@ -118,7 +119,7 @@ data ActionInternalError = ActionInternalError
|
||||
_aieRequest :: !ActionRequestInfo,
|
||||
_aieResponse :: !(Maybe ActionResponseInfo)
|
||||
}
|
||||
deriving (Show, Eq)
|
||||
deriving (Show)
|
||||
|
||||
$(J.deriveToJSON (J.aesonDrop 4 J.snakeCase) ''ActionInternalError)
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
\ }\n }\n}\n"
|
||||
url: http://127.0.0.1:5593/create-user
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: unexpected
|
||||
message: expecting array for action webhook response but got object
|
||||
|
@ -48,6 +48,7 @@
|
||||
\ id\n }\n}\n"
|
||||
url: http://127.0.0.1:5593/null-response
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: unexpected
|
||||
message: expecting array for action webhook response but got null
|
||||
|
@ -64,6 +64,7 @@
|
||||
\ }\n}\n"
|
||||
url: http://127.0.0.1:5593/create-users
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: unexpected
|
||||
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"
|
||||
url: http://127.0.0.1:5593/null-response
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: unexpected
|
||||
message: expecting object for action webhook response but got null
|
||||
|
@ -61,6 +61,7 @@
|
||||
\ }\n }\n}\n"
|
||||
url: http://127.0.0.1:5593/invalid-response
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: parse-failed
|
||||
message: expecting null, object or array of objects for action webhook response
|
||||
|
@ -28,6 +28,7 @@ response:
|
||||
\ id\n name\n }\n}\n"
|
||||
url: http://127.0.0.1:5593/mirror-action
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: unexpected
|
||||
message: field "id" expected in webhook response, but not found
|
||||
|
@ -30,6 +30,7 @@ response:
|
||||
\ $name}){\n id\n name\n }\n}\n"
|
||||
url: http://127.0.0.1:5593/mirror-action
|
||||
headers: []
|
||||
transformed_request:
|
||||
path: $
|
||||
code: unexpected
|
||||
message: expecting not null value for field "id"
|
||||
|
Loading…
Reference in New Issue
Block a user