S3 files can't update
Hi everyone ! Im using the File Upload demo with opensaas but when I delete files directly in the s3, it do not update in the app. Do you know anyway I could fix that ?
6 Replies
Hi @2euxs. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, it's important to note that deleting files directly from S3 might not update the app because the app might not be aware of the changes made directly in the S3 bucket.
You might need to implement a mechanism in your app to sync with the S3 bucket or handle the deletion of files from within the app itself, so it can update its own state accordingly.
For more information on file handling with Wasp and OpenSaaS, you can refer to this guide: OpenSaaS File Uploading Guide (https://docs.opensaas.sh/guides/file-uploading/).
For more specific help, you might want to ask this question in the Wasp community on Discord.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Kapa is on the right track, there should be a sync mechanism between the app and S3.
I'm not sure if S3 exposes a webhook e.g.
onFileDelete
or you'll need to use the S3 API to get the list of files each time to keep them in sync with your app.thank you
Wohooo @2euxs, you just became a Waspeteer level 1!
@kapa.ai How can I get user id
Let me check the knowledge base for you. One moment! :books:
----------------------
In Wasp, you can get the user ID in several ways depending on where you need it.
1. On the server: When authentication is enabled, all queries and actions have access to the
user
object through the context
argument. context.user
contains all User entity's fields and the auth identities connected to the user. Here is an example:
In this example, context.user.id
is used to get the user ID. source (https://wasp-lang.dev/docs/auth/overview#using-the-contextuser-object)
2. On the client: You can use the user
prop or the useAuth
hook to access the user
object. Here is an example using the useAuth
hook:
In this example, user.id
would give you the user ID. source (https://wasp-lang.dev/docs/auth/overview#using-the-useauth-hook)
Remember, the user
object contains all the fields that you defined in your User
entity, plus the auth
field which contains the auth identities connected to the user. source (https://wasp-lang.dev/docs/auth/overview#accessing-the-logged-in-user)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?