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

Supabase storage bucket using for File storage #10

Open
Yeasir0032 opened this issue May 10, 2024 · 23 comments
Open

Supabase storage bucket using for File storage #10

Yeasir0032 opened this issue May 10, 2024 · 23 comments
Labels
enhancement New feature or request gssoc level2

Comments

@Yeasir0032
Copy link
Owner

Functionality to use supabase storage

Currently the project uses uploadthing for storing files. The new mechanism involves using supabase's storage system to store files.
Steps to follow:

  1. Read about supabase storage system.
  2. Understand how supabase works in this project ( for example you can look into this code snippet page.tsx
  3. Trace the references of upload thing.
    • It is used when server is created or edited
    • For file attachment in messaging
  4. Replace the functionality from upload thing to supabase storage .
  5. Make sure to remove uploadthing from package.json by uninstalling it.
@Yeasir0032 Yeasir0032 added enhancement New feature or request level2 labels May 10, 2024
@ArtiGaund
Copy link

Can do updating function to supabase storage ? Can You assign this issue to me?

@Yeasir0032
Copy link
Owner Author

Yeasir0032 commented May 10, 2024

Could you please provide steps how would you achieve this. @ArtiGaund

@ArtiGaund
Copy link

  1. Initialize supabase client (/config/supabase.js)
    import { createClient } from "@supabase/supabase-js"

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_KEY;
const supabase = createClient(supabaseUrl, supabaseKey);

export default supabase

  1. Replacing uploads from uploadthings folder, Uploading with Supabase storage
    import { supabase } from "./config/supabase
    async function uploadFile(file){
    const filePath=...${file.name}
    const {data,error} = await supabase.storage.from('bucket-name').upload(filePath)
    if(error) console.error("Error while uploading file", error)

    return data
    }

  2. Replacing downloads from uploadthings folder, with supabase storage (same as uploads)

  3. removing uploading things from package.json.

@codebreaker3008
Copy link
Contributor

@Yeasir0032 can you assign this issue to me ??

@Yeasir0032
Copy link
Owner Author

@codebreaker3008
I have already assigned her.
If she fails to do so then you will be assigned

@ArtiGaund
Copy link

@Yeasir0032 Is there any timeline to complete it?

@Yeasir0032
Copy link
Owner Author

Yeasir0032 commented May 11, 2024

This issue will not take more than 4 days.
If you need some more time you can ask for it but if you become inactive then I have to give chance to others

@ArtiGaund
Copy link

I will do it try to complete it till tomorrow

@codebreaker3008
Copy link
Contributor

@Yeasir0032 could you assign this to me too, accept the one which does it earlier

@ArtiGaund
Copy link

@Yeasir0032 Where are the tables of Supabase with their fields and their datatype?

@Yeasir0032
Copy link
Owner Author

Screenshot from 2024-05-11 20-28-26
Here is the schema visualizer

@growupanand
Copy link

I am working on the file preview component #19, How much time it can take for a new upload flow any idea?

@ArtiGaund
Copy link

You can assign this issue to someone. My setup is not working, and it is not good to hold an assignment if I am not able to work on it.

@Yeasir0032
Copy link
Owner Author

@codebreaker3008
Do you want to do it?

@codebreaker3008
Copy link
Contributor

@Yeasir0032 yes but i am caught up in some personal issues, you could assign it to me but it will take some time

@Yeasir0032
Copy link
Owner Author

Hey @ArtiGaund , could you update your progress. Let's fix the error you are facing.

@ArtiGaund
Copy link

I will update in night bcz my laptop is updating now, it was freezing alot, so today I am updating it, may be it will resolve freezing issue.

@Yeasir0032
Copy link
Owner Author

Yeasir0032 commented May 24, 2024

How far have you reached? @ArtiGaund
Did you setup supabase database (Postgres) on your own. If yes then please add your schema visualizer as I have done above. If no then we need to do that first.
Following steps

  • Create a storage bucket in supabase
  • Creating a upload dropzone and uploading to storage bucket.

@ArtiGaund
Copy link

Created buckets in database done

@ArtiGaund ArtiGaund removed their assignment May 26, 2024
@Yeasir0032
Copy link
Owner Author

Hey @ArtiGaund
The documentation for table setup has been added. Do check Learn.md file.

@ArtiGaund
Copy link

Screenshot (341)

Before upload file button was working, now its not working. Not able to upload image.

@PayalKumari10
Copy link
Collaborator

Hello, @ArtiGaund any update on this issue?

@ArtiGaund
Copy link

This issue is not assigned to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gssoc level2
Projects
None yet
Development

No branches or pull requests

5 participants