hasura / hasura/graphql-engine

REST API: 'Run Request' fails with the error 'Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.'

Open
#9,369 0 comments 0 reactions 0 assignees View on GitHub
k/bug t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: Many versions (Tried in v2.6.2, 2.8.4, v2.16.1)

### Environment

Any (Tried in OSS)

### What is the current behaviour?

Trying to run a REST API that has variables that uses the HTTP GET method results in the error -
Screenshot 2023-01-09 at 9 41 07 PM

### What is the expected behaviour?

Clicking 'Run request' should work and the results should be shown.

### How to reproduce the issue?

1. Create and track the table -
```sql
CREATE TABLE author(id SERIAL PRIMARY KEY, name TEXT);
```
2. Track the following query as a REST API
```graphql
query Authors($offset: Int = 0) {
author(limit: 10, offset: $offset) {
id
name
}
}
```
Screenshot 2023-01-09 at 9 47 33 PM
3. Click on the newly created REST
Screenshot 2023-01-09 at 9 48 20 PM
API and click on 'Run request'

### Keywords

REST Run request

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Reproduce the issue by tracking the provided GraphQL query as a REST API with a GET method, then trace the REST “Run request” flow in the TypeScript code. Done means the request runs successfully and displays results without the GET/HEAD body error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.