You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most likely it's an issue with Bun. It happens when integrating GraphQL Yoga with Express and using express.json() middleware. Also the bug occurs when integrating Yoga with Fastify
import{createYoga}from'graphql-yoga'importexpressfrom'express';import{createSchema}from'graphql-yoga'exportconstschema=createSchema({typeDefs: ` type Query { hello: String } `,resolvers: {Query: {hello: ()=>'world'}}})constapp=express()// The Request.url getter can only be used on instances of Requestapp.use(express.json({limit: '1mb'}));constyoga=createYoga({ schema })app.use(yoga.graphqlEndpoint,yoga)app.listen(4000,()=>{console.log('Running a GraphQL API server at http://localhost:4000/graphql')})
Call stack:
Unexpected response: "TypeError: The Request.url getter can only be used on instances of Request
at get (:1:11)
at onRequest (node_modules/graphql-yoga/esm/plugins/use-health-check.js:4:17)
at iterate (node_modules/@whatwg-node/server/esm/utils.js:380:25)
at handleRequest (node_modules/@whatwg-node/server/esm/createServerAdapter.js:51:46)
at requestListener (node_modules/@whatwg-node/server/esm/createServerAdapter.js:127:25)
at <anonymous> (native)
at handle (node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (node_modules/express/lib/router/index.js:328:13)
at <anonymous> (node_modules/express/lib/router/index.js:286:9)
at next (node_modules/express/lib/router/index.js:280:10)
at <anonymous> (node_modules/body-parser/lib/read.js:137:5)
at runInAsyncScope (node:async_hooks:159:18)
at invokeCallback (node_modules/raw-body/index.js:238:16)
at done (node_modules/raw-body/index.js:227:7)
at onEnd (node_modules/raw-body/index.js:287:7)
at emit (node:events:183:48)
at endReadableNT (node:stream:2392:27)
at processTicksAndRejections (:7:39)
Expected behavior
No error occurs
Screenshots or Videos
No response
Platform
OS: macOS
Bun 1.1.30
@graphql-yoga/* version(s): 5.7.0
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
Most likely it's an issue with Bun. It happens when integrating GraphQL Yoga with Express and using express.json() middleware. Also the bug occurs when integrating Yoga with Fastify
Your Example Website or App
https://codesandbox.io/p/devbox/bun-yoga-crckwv
Steps to Reproduce the Bug or Issue
Call stack:
Expected behavior
No error occurs
Screenshots or Videos
No response
Platform
@graphql-yoga/*
version(s): 5.7.0Additional context
No response
The text was updated successfully, but these errors were encountered: