apollographql / apollographql/fullstack-tutorial
Error when fetching past end of Launches
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
Cursor is defined as non-nullable:
```
type LaunchConnection { # add this below the Query type as an additional type.
cursor: String!
hasMore: Boolean!
launches: [Launch]!
}
```
But if no launches are retrieved (for example if you pass in a cursor for which `hasMore` was false), then the code will carefully return `null` for the cursor:
```
return {
launches,
cursor: launches.length ? launches[launches.length - 1].cursor : null,
```
Resulting in INTERNAL_SERVER_ERROR:
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the LaunchConnection schema below the Query type and the resolver return object shown in the issue. Reproduce a request using a cursor past the end of the launches, then make the schema and returned cursor behavior consistent. Done means the request returns a valid GraphQL response instead of INTERNAL_SERVER_ERROR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100