storage
storage copied to clipboard
Last modified timestamp changes before the file is updated
Bug report
Describe the bug
Backstory: In my app, the user has to put a closing signature on a contract that is already in the storage. The contract is then uploaded to the storage again overwriting the previous version, and an email with the signed contract is emailed to the customer.
To ensure the contract was updated before being emailed, I tried to poll the Last modified timestamp until it changed. This however led to inconsistent results of the contract sometimes being delivered unsigned (original version before overwriting).
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
(Sorry, no code as I changed the app to implement a workaround.)
- Save the Last modified timestamp
- Overwrite the file
- Check if the Last modified timestamp has changed
- Download the file
Expected behavior
The downloaded file must be of the latest version
System information
- Version of supabase-js: 2.45.4
- Version of Node.js: 22.x (Vercel)
You can use supabase webhooks they are much better for these instances.
This is expected because we upsert the record in the DB before the upload starts and then rollback is it passes, this is for checking RLS.
If you have a trigger that relies on waiting that the object is fully uploaded, you can check if the metadata field is not NULL before running your logic