POST body missing, invalid Content-Type, or JSON object has no keys.

Open
#9,013 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
graphql, nextjs, node.js, typescript
Domain
api, backend

Research direction

Start by reproducing the Keystone image upload with the Next.js pages router, Node 18, Next.js 14.1.0, and the reported Apollo Server or graphql-yoga integration. Compare behavior with bodyParser disabled versus enabled and verify that the upload completes without the missing-body, invalid Content-Type, duplex, or missing stream/arrayBuffer errors.

Written by the indexing model from the issue text.

Description

Using Keystone nextjs pages router monorepo with apollo server instead of graphql-yoga, this happens when I try to upload an image from the image field of keystone.

POST body missing, invalid Content-Type, or JSON object has no keys.

if I use graphql-yoga instead I get a duplex issue which looks like this:

RequestInit: duplex option is required when sending a body

and this happens when I have bodyParser as false but if I remove bodyParser I get no steam or arrayBuffer in the File response so I cannot upload the image properly.

So any thoughts regarding that would be much appreciated! Thanks in advance

Should be uploaded without errors

Screenshot 2024-02-08 at 3 43 39 PM

"@apollo/server": "^4.9.5",
"@as-integrations/next": "^3.0.0",
"graphql-yoga": "^5.1.1",

Node version: 18
Nextjs: 14.1.0

Dominant language
TypeScript
Stars
10k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
38

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from keystonejs/keystone

All issues in keystonejs/keystone

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.