graphql-yoga: TypeError: Request is not a constructor
This is happening inside cross-undici-fetch (which is a non-src package inside of https://github.com/ardatan/w3-server)
TypeError: Request is not a constructor
at getNodeRequest (file:///Users/ian/Projects/rel/repo/node_modules/.pnpm/@graphql-yoga+node@0.1.0-alpha.3_graphql@15.8.0/node_modules/@graphql-yoga/node/index.mjs:42:16)
at YogaNodeServer.handleIncomingMessage (file:///Users/ian/Projects/rel/repo/node_modules/.pnpm/@graphql-yoga+node@0.1.0-alpha.3_graphql@15.8.0/node_modules/@graphql-yoga/node/index.mjs:148:31)
at Object.handler (file:///Users/ian/Projects/rel/repo/packages/rel-server/dist/index.js:97:44)
at preHandlerCallback (/Users/ian/Projects/rel/repo/node_modules/.pnpm/fastify@3.25.3/node_modules/fastify/lib/handleRequest.js:126:28)
at preValidationCallback (/Users/ian/Projects/rel/repo/node_modules/.pnpm/fastify@3.25.3/node_modules/fastify/lib/handleRequest.js:109:5)
at handler (/Users/ian/Projects/rel/repo/node_modules/.pnpm/fastify@3.25.3/node_modules/fastify/lib/handleRequest.js:72:7)
at /Users/ian/Projects/rel/repo/node_modules/.pnpm/fastify@3.25.3/node_modules/fastify/lib/contentTypeParser.js:174:9
at AsyncResource.runInAsyncScope (node:async_hooks:199:9)
at done (/Users/ian/Projects/rel/repo/node_modules/.pnpm/fastify@3.25.3/node_modules/fastify/lib/contentTypeParser.js:169:14)
at Parser.defaultJsonParser [as fn] (/Users/ian/Projects/rel/repo/node_modules/.pnpm/fastify@3.25.3/node_modules/fastify/lib/contentTypeParser.js:269:5)
Package:
"@graphql-yoga/node": "^0.1.0-alpha.3",
Have tried with canary as well.
This is happening inside of getNodeRequest and tries to use the cross-undici-fetch Request object:
When I output the default export from Undici it’s missing a ton:
{
fetch: [Function (anonymous)],
Headers: undefined,
Request: undefined,
Response: undefined,
FormData: undefined,
AbortController: [class AbortController],
ReadableStream: [class ReadableStream],
WritableStream: [class WritableStream],
TransformStream: [class TransformStream],
Blob: [class Blob],
File: undefined
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15
@ardatan that worked for me, thanks for the fast turnaround!