question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uploading Image or other non text file gets corrupted || File Upload example Not working

See original GitHub issue

Describe the bug

I use graphql-yoga with NextJS and whenever I try to upload images, pdf or any other non-text file it gets corrupted whenever I use arrayBuffer(). And it seems stream() does not work as well Screen Shot 2022-06-30 at 10 27 59 AM .

Your Example Website or App

https://gist.github.com/richieroldan/a1d518b7b6279d106a2cd2fb4ebb3d76

Steps to Reproduce the Bug or Issue

  1. Create NextJS app yarn create next-app --typescript
  2. create pages/api/graphql.ts
  3. setup the graphql-yoga server
  4. add mutation with file upload
  5. run yarn dev
  6. try to upload non-text file

Expected behavior

I should be able to save images, pdf, and any other files without corrupting them.

Screenshots or Videos

No response

Platform

  • OS: MacOS (Intel)
  • NodeJS: 14.17.1
  • Tried @graphql-yoga/* version(s): 2.10.0 and 2.0.0

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
n1ru4lcommented, Jul 1, 2022

The documentation and examples will be fixed as part of https://github.com/dotansimha/graphql-yoga/pull/1332

0reactions
richieroldancommented, Jul 1, 2022

That’s good @n1ru4l ! I can confirm that it works! Thanks a lot!

Will close this issue now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Uploading images get corrupted but not txt files
I am trying to upload an image using AWS lambdas but my images get corrupted I tested with a txt file and it...
Read more >
Images upload but don't display because they are corrupted
Text files are working. I created a simple text file and uploaded it to a page node. Then navigated to the page, clicked...
Read more >
How You Can Fix The Biggest Problem With React File ...
Under certain conditions, a file uploader will immediately report a server error where the console tracks a file upload, but it does not...
Read more >
7 Reasons Why Images Are Not Loading on Your Website
Website images fail to load for one of these seven common reasons.
Read more >
Fix problems uploading files on the OneDrive website
If the file is on a server, make sure you can open the file, and then try to upload it again.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found