Uploading file crashes application when built with webpack
See original GitHub issueHi
I am trying to use graphql-upload
in a typescript app built with webpack.
My setup
- Typescript app
- Apollo server / Typegraphql
- Build with webpack
My Code
(stripped down to the essentials)
https://github.com/ziggy6792/graphql-file-uploads
My Problem
When I run with ts-node yarn start:ts:node
then run yarn test
an image gets uploaded no problem
But then I build with webpack yarn start
then run yarn test
I get the following error
/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:56105
if (!isObject(operations) && !Array.isArray(operations))
^
TypeError: isObject is not a function
at Busboy.<anonymous> (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:56105:18)
at Busboy.emit (node:events:378:20)
at Busboy.module.exports../node_modules/busboy/lib/main.js.Busboy.emit (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:32204:33)
at PartStream.onEnd (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:32528:15)
at PartStream.emit (node:events:390:22)
at Dicer.onPart (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:32386:13)
at Dicer.emit (node:events:378:20)
at Dicer.module.exports../node_modules/dicer/lib/Dicer.js.Dicer.emit (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:45439:35)
at Dicer.module.exports../node_modules/dicer/lib/Dicer.js.Dicer._oninfo (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:45540:12)
at SBMH.<anonymous> (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:45486:10)
[nodemon] app crashed - waiting for file changes before starting...
My Attempts to solve
Sorry I am not sure if this actually a problem with graphql-upload
or webpack
or something else. I also noticed that my issue looks similar to this issue, but I didn’t really understand if there were any fixes to that issue and if indeed it is the same issue I am facing.
I tried to upgrade webpack (branch upgraded-packages
) but this made the problem worse as I get this issue when I start the server
TypeError: Cannot read property 'graphql' of undefined
at getPeerDependencyGraphQLRequirement (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:104216:44)
at Object.ensureInstalledCorrectGraphQLPackage (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:104221:32)
at Function.checkForErrors (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103346:27)
at Function.generateFromMetadataSync (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103325:14)
at Function.generateFromMetadata (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103315:29)
at Object.buildSchema (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103940:61)
at /Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:99831:41
at Generator.next (<anonymous>)
at /Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:99819:71
at new Promise (<anonymous>)
```
Any help would be greatly appreciated.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Express application crashes when it is built with webpack
I am trying to use graphql-upload in a typescript express app (graphql api) built with webpack. When I run with ts-node my app...
Read more >Troubleshooting build errors and crashes - Expo Documentation
This particular error means that the app is importing ./src/Routes and it is not found. The cause could be that the filename case...
Read more >Eight Practices in React That Will Crash Your App in the Future
If you're currently building an application using react or thinking of using react for upcoming projects, then this tutorial is for you.
Read more >How to fix the Whitescreen After a Static Deployment with ...
Specifiying “homepage” Now that we told your app it's base URL, run npm run build again and copy the app to your web...
Read more >Untitled
The built-in Photos app on Mac offers several useful photo editing tools. ... May 30, 2019 · Before start learning react image or...
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
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
Hi @rickklaasboer
Thanks for your input. I would really like to get webpack5 working.
I tried your suggestion and pushed to branch webpack5
However I still get the same error when I start
Thanks
Hey @jaydenseric
I worked it out with
esbuild
I just needed to use an extra plugin@anatine/esbuild-decorators
Thanks again for your help.