2020-04-24 10:55:51 +03:00
|
|
|
.. meta::
|
|
|
|
:description: Deriving Hasura actions
|
|
|
|
:keywords: hasura, docs, actions, debug, debugging
|
|
|
|
|
|
|
|
.. _debugging_actions:
|
|
|
|
|
|
|
|
Debugging actions
|
|
|
|
=================
|
|
|
|
|
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
2020-04-29 10:46:02 +03:00
|
|
|
While you're developing actions for your application, to debug faster you may
|
|
|
|
want to see the exact details of the webhook call for the action
|
|
|
|
as well.
|
2020-04-24 10:55:51 +03:00
|
|
|
|
2020-05-19 10:55:59 +03:00
|
|
|
To do so, start the server in :ref:`debugging mode <dev-mode>`.
|
2020-04-29 10:46:02 +03:00
|
|
|
In the case of errors, the GraphQL response will contain debugging information
|
|
|
|
of the webhook calls in the ``extensions.internal`` field.
|
2020-04-24 10:55:51 +03:00
|
|
|
|
2021-11-02 17:35:35 +03:00
|
|
|
If you are using action transforms, then you will also see the ``transformed_request``
|
|
|
|
inside the ``request`` field.
|
|
|
|
|
2020-04-29 10:46:02 +03:00
|
|
|
**For example**:
|
2020-04-24 10:55:51 +03:00
|
|
|
|
2020-04-29 10:46:02 +03:00
|
|
|
.. graphiql::
|
|
|
|
:view_only:
|
|
|
|
:query:
|
|
|
|
mutation {
|
2020-04-24 10:55:51 +03:00
|
|
|
create_user(email: "foo@bar.com", name: "Foo"){
|
|
|
|
id
|
|
|
|
user {
|
|
|
|
name
|
|
|
|
email
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-29 10:46:02 +03:00
|
|
|
:response:
|
2020-04-24 10:55:51 +03:00
|
|
|
{
|
|
|
|
"errors": [
|
|
|
|
{
|
2021-10-11 09:55:05 +03:00
|
|
|
"message": "expecting null, object or array of objects for action webhook response",
|
2020-04-24 10:55:51 +03:00
|
|
|
"extensions": {
|
2020-04-29 10:46:02 +03:00
|
|
|
"code": "parse-failed",
|
|
|
|
"path": "$",
|
2020-04-24 10:55:51 +03:00
|
|
|
"internal": {
|
2021-10-11 09:55:05 +03:00
|
|
|
"error": "expecting null, object or array of objects for action webhook response",
|
2020-04-24 10:55:51 +03:00
|
|
|
"response": {
|
|
|
|
"status": 200,
|
|
|
|
"headers": [
|
|
|
|
{
|
|
|
|
"value": "application/json",
|
|
|
|
"name": "Content-Type"
|
|
|
|
}
|
2020-04-29 10:46:02 +03:00
|
|
|
],
|
|
|
|
"body": "[incorrect response]"
|
2020-04-24 10:55:51 +03:00
|
|
|
},
|
|
|
|
"request": {
|
2020-04-29 10:46:02 +03:00
|
|
|
"url": "http://127.0.0.1:5593/invalid-response",
|
|
|
|
"headers": [],
|
2020-04-24 10:55:51 +03:00
|
|
|
"body": {
|
2020-04-29 10:46:02 +03:00
|
|
|
"action": {
|
|
|
|
"name": "create_user"
|
|
|
|
},
|
2020-04-24 10:55:51 +03:00
|
|
|
"session_variables": {
|
|
|
|
"x-hasura-role": "admin"
|
|
|
|
},
|
|
|
|
"input": {
|
|
|
|
"email": "foo@boo.com",
|
|
|
|
"name": "Foo"
|
2021-09-20 21:19:39 +03:00
|
|
|
},
|
|
|
|
"request_query": "mutation {\n create_user(email: \"foo@bar.com\", name: \"Foo\"){\n id\n user {\n name\n email\n }\n }\n }\n"
|
2021-11-02 17:35:35 +03:00
|
|
|
},
|
|
|
|
"transformed_request": {
|
|
|
|
"query_string": "",
|
|
|
|
"body": "[transformed body]",
|
|
|
|
"url": "http://127.0.0.1:3000/abcd",
|
|
|
|
"headers": [
|
|
|
|
[
|
|
|
|
"Content-Type",
|
|
|
|
"application/json"
|
|
|
|
]
|
|
|
|
],
|
|
|
|
"method": "PATCH",
|
|
|
|
"response_timeout": "30000000"
|
|
|
|
},
|
2020-04-29 10:46:02 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-24 10:55:51 +03:00
|
|
|
}
|
|
|
|
]
|
2021-03-09 11:36:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
.. admonition:: Additional Resources
|
|
|
|
|
2021-11-02 17:35:35 +03:00
|
|
|
Introduction to Hasura Actions - `View Recording <https://hasura.io/events/webinar/hasura-actions/?pg=docs&plcmt=body&cta=view-recording&tech=>`__.
|