Cannot use express with body parser and graphql yoga. I also tried fastify and get same error. Express works fine until I try to use the body parser.
The error itself happens in this file use-health-check.ts in graphql-yoga. Specifically, this line:
(17) request.url.endsWith(endpoint)
Here's a simple way to reproduce it:
Setup
bun init
bun add graphql graphql-yoga express
index.ts
import { createYoga } from 'graphql-yoga'
import express from 'express';
import { createSchema } from 'graphql-yoga'
export const schema = createSchema({
typeDefs: /* GraphQL */ `
type Query {
hello: String
}
`,
resolvers: {
Query: {
hello: () => 'world'
}
}
})
const app = express()
app.use(express.json({ limit: '1mb' }));
const yoga = createYoga({ schema })
app.use(yoga.graphqlEndpoint, yoga)
app.listen(4000, () => {
console.log('Running a GraphQL API server at http://localhost:4000/graphql')
})
What version of Bun is running?
1.1.18+5a0b93523
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
Cannot use express with body parser and graphql yoga. I also tried fastify and get same error. Express works fine until I try to use the body parser. The error itself happens in this file use-health-check.ts in graphql-yoga. Specifically, this line:
(17) request.url.endsWith(endpoint)
Here's a simple way to reproduce it:
Setup
bun init bun add graphql graphql-yoga express
index.ts
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response