Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphiql koa 0.9.0 Error: Can't set headers after they are sent #439

Closed
vladshcherbin opened this issue Jun 29, 2017 · 6 comments
Closed

Comments

@vladshcherbin
Copy link
Contributor

vladshcherbin commented Jun 29, 2017

After updating to graphql-server-koa 0.9.0, there is an error when trying to use graphiql. Graphql itself is working. No error in 0.8.5.

Error: Can't set headers after they are sent.

Updated packages:

- graphql-server-core@0.9.0
- graphql-server-koa@0.9.0
- graphql-server-module-graphiql@0.9.0

Env:

  • node 8.1.2
  • mac os 10.12.5
  • koa 2.3.0
  • koa-router 7.2.1
  • koa-bodyparser 4.2.0

Code:

import { createServer } from 'http'
import Koa from 'koa'
import Router from 'koa-router'
import koaBody from 'koa-bodyparser'
import { graphqlKoa, graphiqlKoa } from 'graphql-server-koa'
import schema from './graphql'

const app = new Koa()
const router = new Router()

router
  .get('/', async (ctx) => {
    ctx.body = 'Main / Home'
  })
  .get('/graphiql', graphiqlKoa({ endpointURL: '/graphql' }))
  .post('/graphql', koaBody(), graphqlKoa({ schema }))

app
  .use(router.routes())
  .use(router.allowedMethods())

const server = createServer(app.callback())

server.listen(3000)
@DxCx
Copy link
Contributor

DxCx commented Jun 30, 2017

is that still happens on version 1.0.0?
anyway, this is the diff between the versions:
0d5add0

@NeoPhi can you take a look at that?

@vladshcherbin
Copy link
Contributor Author

@DxCx yes, this also happens on 1.0.0.

I think, await is missing in graphiql resolution somewhere here.

@vladshcherbin
Copy link
Contributor Author

This was fixed.

@arvi
Copy link

arvi commented Feb 8, 2018

@vladshcherbin hello what was the fix? Can you post the commit id? Thanks a lot. I am having the same issue on a different package graphql/graphql-playground#557

@vladshcherbin
Copy link
Contributor Author

@arvi this one I guess: c22bb37

@arvi
Copy link

arvi commented Feb 8, 2018

@vladshcherbin thanks, reported it to graphcool 😄

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants