Azure / Azure/api-management-developer-portal

GraphQL display problem Error: Body must be a string. Received: undefined

Open
#2,687 0 comments 0 reactions 0 assignees View on GitHub
(u) GraphQL
Dominant language
TypeScript
Stars
545
Forks
360
PR merge metrics
No merged PRs in 30d

Description

## Bug description

GraphQL API is not displayed in the Self-hosted developer portal, we got a loading sign which never stops.

## Reproduction steps

1. Import Synthetic GraphQL API with sample schema
3. Open Graph QL API in developer portal
4. Nothing is displayed on the page

## Expected behavior

A javascript exception is displayed:
Error: Body must be a string. Received: undefined.
at devAssert (webpack://apim-developer-portal/./node_modules/graphql/jsutils/devAssert.mjs?:9:11)
at new Source (webpack://apim-developer-portal/./node_modules/graphql/language/source.mjs?:33:99)
at new Parser (webpack://apim-developer-portal/./node_modules/graphql/language/parser.mjs?:84:94)
at parse (webpack://apim-developer-portal/./node_modules/graphql/language/parser.mjs?:31:16)
at Module.buildSchema (webpack://apim-developer-portal/./node_modules/graphql/utilities/buildASTSchema.mjs?:101:77)
at GraphDocService.eval (webpack://apim-developer-portal/./src/components/operations/operation-details/ko/runtime/graphql-documentation/graphql-doc-service.ts?:66:40)
at Generator.next ()
at fulfilled (webpack://apim-developer-portal/./src/components/operations/operation-details/ko/runtime/graphql-documentation/graphql-doc-service.ts?:5:58)

## Is self-hosted portal?

Yes

## Release tag or commit SHA (if using self-hosted version)

release tag`2.27`

## Environment

azure static web app

## Additional context

Example Schema that we used:

type User {
id: ID!
username: String!
email: String!
createdAt: String!
reservations: [Reservation!]!
}

type Reservation {
id: ID!
userId: ID!
startDate: String!
endDate: String!
status: String!
createdAt: String!
user: User!
}

type Query {
users: [User!]!
user(id: ID!): User
reservations: [Reservation!]!
reservation(id: ID!): Reservation
}

type Mutation {
createUser(username: String!, email: String!): User!
createReservation(userId: ID!, startDate: String!, endDate: String!, status: String!): Reservation!
updateReservation(id: ID!, startDate: String, endDate: String, status: String): Reservation!
deleteReservation(id: ID!): Boolean!
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at src/components/operations/operation-details/ko/runtime/graphql-documentation/graphql-doc-service.ts:66, where the stack trace shows GraphQL schema processing fails. Reproduce with the supplied schema by importing a Synthetic GraphQL API and opening it in the self-hosted developer portal. Done means the GraphQL API displays instead of remaining on the loading state or raising the undefined-body error.

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.