TypeError: Request is not a constructor
See original GitHub issueThis 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:
![CleanShot 2022-01-31 at 11 35 20@2x](https://user-images.githubusercontent.com/19853/151844044-cfc161d5-6220-4053-a03b-209e584701f4.png)
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
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:15
Top Results From Across the Web
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >Javascript "Not a Constructor" Exception while creating objects
The reason is that when it is attempting to initialize y, it creates a temporary "y" object (not class, object!) in the dependency...
Read more >Resolving TypeError: "X" is Not a Constructor in JavaScript
JavaScript "TypeError: "x" is not a constructor" errors occur when invalid objects or a variable is erroneously used as a constructor.
Read more >JavaScript TypeError - "X" is not a constructor - GeeksforGeeks
This JavaScript exception is not a constructor that occurs if code tries to use an object or a variable as a constructor, which...
Read more >TypeError: "X" is not a constructor in JavaScript | bobbyhadz
To solve the "TypeError: 'X' is not a constructor" in JavaScript, make sure to only use the new operator on valid constructors, e.g....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ardatan that worked for me, thanks for the fast turnaround!
@ian Thank you for reporting this issue!