Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't delete file #28

Open
ahmadfaizk opened this issue Apr 17, 2024 · 0 comments
Open

Can't delete file #28

ahmadfaizk opened this issue Apr 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ahmadfaizk
Copy link

Bug report

Describe the bug

Got error "body must be object" when delete file

To Reproduce

Got error when remove file, the error is "body must be object", after i debug when call api to remove object got this response,
{"statusCode":"400","error":"Error","message":"body must be object"}
This is my code

type SupabaseStorage struct {
	client     *storage_go.Client
	bucketName string
}

func NewStorage(conf *config.Config) storage.Storage {
	storageUrl := fmt.Sprintf("%s/storage/v1", conf.Supabase.Url)
	client := storage_go.NewClient(storageUrl, conf.Supabase.Key, nil)

	return &SupabaseStorage{
		client:     client,
		bucketName: conf.Supabase.Bucket,
	}
}

func (s *SupabaseStorage) Delete(filename string) error {
	_, err := s.client.RemoveFile(s.bucketName, []string{filename})
	if err != nil {
		return err
	}
	return nil
}

Expected behavior

Successfully delete file

System information

  • Version of supabase-go: v0.7.0
  • Version of Golang: 1.22
@ahmadfaizk ahmadfaizk added the bug Something isn't working label Apr 17, 2024
@tranhoangvuit tranhoangvuit self-assigned this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants