This repository was archived by the owner on Oct 9, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 52
StorageUnknownError: fetch failed | NestJSΒ #161
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hello, I am trying to upload an image to existing public bucket
async updateAvatar(file: Express.Multer.File) {
const { originalname, mimetype, buffer } = file;
const { data, error } = await this.storage
.from('avatars')
.upload(`public/${originalname}`, buffer, {
contentType: mimetype,
upsert: false,
});
if (error) {
throw new Error(error.message);
}
return data;
}But getting error:
{
data: null,
error: StorageUnknownError: fetch failed
at /Users/karrtopelka/Documents/business_idea/proposal/server/node_modules/@supabase/storage-js/src/lib/fetch.ts:32:12
at Generator.next (<anonymous>)
at fulfilled (/Users/karrtopelka/Documents/business_idea/proposal/server/node_modules/@supabase/storage-js/dist/main/lib/fetch.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
__isStorageError: true,
originalError: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:14294:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
cause: [Error]
}
}
}Here is my service:
import { Injectable } from '@nestjs/common';
import { StorageClient } from '@supabase/storage-js';
@Injectable()
export class SupabaseService extends StorageClient {
constructor() {
super(process.env.STORAGE_URL, {
apikey: process.env.API_SECRET,
Authorization: `Bearer ${process.env.API_SECRET}`,
});
}
}What can be the issue?
Found unanswered question but with svelte: https://github.com/supabase/supabase/discussions/12389_
kirillmarkelov
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working