hasura / hasura/graphql-engine

logging action webhook calls

Open
#4,171 0 comments 0 reactions 0 assignees View on GitHub
c/actions c/server k/enhancement p/high
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

When `HASURA_GRAPHQL_LOG_LEVEL` is set to `debug`, then log the **request** to and **response** from the action webhook call. The log-type of this should be `action` (similar to `event-trigger` log-type for event trigger responses). So it will look like (similar to event trigger logs)

```
{
"type":"action",
"timestamp":"2020-03-18T06:20:35.373+0000",
"level":"debug",
"detail":{
"context":{"action_id":"5d8a8bed-024c-40ca-9521-287c330f83c2"}, # any kind of context (for e.g. action_id for async actions)
"request":{"url": "", "body":"{}", "headers": []},
"response":{"status":200,"body":"{}", "headers": []}
}
}
```

**Note on logging headers**:

- Request headers should be redacted based on whether the value is environment variable and should be over-rideable using `LOG_HEADERS_FROM_ENV` env flag. This infra already exists for Event Triggers -- see https://github.com/hasura/graphql-engine/blob/4d2dbe68fa244ea100356ca1f104f7fb1c6ee2ae/server/src-lib/Hasura/App.hs#L257 and https://github.com/hasura/graphql-engine/blob/4d2dbe68fa244ea100356ca1f104f7fb1c6ee2ae/server/src-lib/Hasura/Events/Lib.hs#L370

- Header `Authorization` should be redacted.

- Redacting response headers will be outside the scope of this spec. We can also choose to not log response headers till we spec this.

Contributor guide

Open the contributing guide

Research direction

Start by comparing Hasura/App.hs and Hasura/Events/Lib.hs for the existing event-trigger logging and header-redaction behavior, then locate the action webhook request and response path. Done means debug-level logs use type action, include the request, response, and available context, redact Authorization and environment-derived request headers with LOG_HEADERS_FROM_ENV, and omit response-header redaction as specified.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.