hasura / hasura/graphql-engine

Actions "Headers" section error with {{ $body.input?.xxx }}

Open
#10,187 0 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.38.1
CLI Version (for CLI related issue):

### Environment

OSS
### What is the current behaviour?

I'm experiencing an error when using {{ $body.input?.xxx }} in the "Headers" section of Hasura Actions.

### What is the expected behaviour?

{{ $body.input?.xxx }} should be evaluated and the result should be included in the request headers.

### How to reproduce the issue?

1. Goto Actions
2. New Action Or Modify
3. Try to use {{ $body.input?.xxx }} in the "Headers" section.
4. Goto API
5. Call API

### Screenshots or Screencast
![스크린샷 2024-04-04 오전 11 00 06](https://github.com/hasura/graphql-engine/assets/3200245/71129f62-a283-451a-88af-bce0e414d326)

![스크린샷 2024-04-04 오전 10 59 29](https://github.com/hasura/graphql-engine/assets/3200245/238e5f3e-d691-461c-8ccb-5f1c90eeade0)

### Please provide any traces or logs that could help here.

### Any possible solutions/workarounds you're aware of?

I was able to work around this issue by adding request_transform.request_headers.add_headers to the metadata.

setting showRequestHeaders to true in the frontend source code.
[Link](https://github.com/hasura/graphql-engine/blob/release/v2.38/frontend/libs/console/legacy-ce/src/lib/components/Common/ConfigureTransformation/RequestOptionsTransforms.tsx#L35)

### Keywords
1. OpenAPI
2. Headers
3. add_headers
6. showRequestHeaders

Contributor guide

Open the contributing guide

Research direction

Start by reading frontend/libs/console/legacy-ce/src/lib/components/Common/ConfigureTransformation/RequestOptionsTransforms.tsx around showRequestHeaders and reproduce the issue through a Hasura Action with {{ $body.input?.xxx }} in Headers. Compare the generated request with the request_transform.request_headers.add_headers workaround; done means the expression is evaluated and its result is included in the request headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.