storage
storage copied to clipboard
>100 KB File Upload Throws "TypeError: fetch failed"
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When trying to upload big file from server-side user action in Next.JS it throws an error described above.
In 10% if the image is less then 100KB all is done successfully.
Code to throw an error
const { data, error } = await createServerActionClient({ cookies }, { supabaseKey: process.env.SUPABASE_SERVICE_ROLE_KEY, supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL })
.storage
.from('images')
.upload(path, image);
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Mac OS
- Call function above from Next.JS server actions (I saw same problem on StackOverflow without Next.JS server actions)
- Error
Expected behavior
The image must be uploaded to the Storage
Screenshots
System information
- OS: MacOS
- Version of supabase-js: 2.33.2
- Version of Node.js: 20.5.1
Additional context
Error, which looked similar (NOT ON GITHUB): https://stackoverflow.com/questions/76424910/supabase-typeerror-fetch-failed
I have temporary solved this problem for myself:
The problem happens, when I send File to Supabase Storage.
To solve the problem, I send Array Buffer:
let array_buffer = await image.arrayBuffer();
I'm having this issue aswell.
I have to send array buffers as well.
Closing this issue for now. By sending arrayBuffer seems the correct approach.