graphql-engine/docs/graphql/manual/actions/debugging.rst
Rakesh Emmadi 6f100e0009
improve debug information in actions errors response (close #4031) (#4432)
* config options for internal errors for non-admin role, close #4031

More detailed action debug info is added in response 'internal' field

* add docs

* update CHANGELOG.md

* set admin graphql errors option in ci tests, minor changes to docs

* fix tests

Don't use any auth for sync actions error tests. The request body
changes based on auth type in session_variables (x-hasura-auth-mode)

* Apply suggestions from code review

Co-Authored-By: Marion Schleifer <marion@hasura.io>

* use a new sum type to represent the inclusion of internal errors

As suggested in review by @0x777
-> Move around few modules in to specific API folder
-> Saperate types from Init.hs

* fix tests

Don't use any auth for sync actions error tests. The request body
changes based on auth type in session_variables (x-hasura-auth-mode)

* move 'HttpResponse' to 'Hasura.HTTP' module

* update change log with breaking change warning

* Update CHANGELOG.md

Co-authored-by: Marion Schleifer <marion@hasura.io>
Co-authored-by: Tirumarai Selvan <tiru@hasura.io>
2020-04-24 13:25:51 +05:30

81 lines
2.1 KiB
ReStructuredText

.. meta::
:description: Deriving Hasura actions
:keywords: hasura, docs, actions, debug, debugging
.. _debugging_actions:
Debugging actions
=================
.. contents:: Table of contents
:backlinks: none
:depth: 1
:local:
While you're developing actions for your application, you may want to debug the webhook
configured for the action. To do so, start the server in :ref:`debugging mode <errors-debugging>`.
In the case of errors, the GraphQL response contains debugging information of webhook
calls in the ``extensions.internal`` field.
For example, let's consider the following mutation:
.. code-block:: graphql
mutation {
create_user(email: "foo@bar.com", name: "Foo"){
id
user {
name
email
is_admin
}
}
}
In case of errors, the response will look like the following if the debugging mode is enabled.
.. code-block:: json
{
"errors": [
{
"extensions": {
"internal": {
"response": {
"status": 200,
"body": "some-string",
"headers": [
{
"value": "application/json",
"name": "Content-Type"
}
]
},
"request": {
"body": {
"session_variables": {
"x-hasura-role": "admin"
},
"input": {
"email": "foo@boo.com",
"name": "Foo"
},
"action": {
"name": "create_user"
}
},
"url": "http://127.0.0.1:5593/invalid-response",
"headers": [
]
},
"error": "expecting object or array of objects for action webhook response"
},
"path": "$",
"code": "parse-failed"
},
"message": "expecting object or array of objects for action webhook response"
}
]
}