storage icon indicating copy to clipboard operation
storage copied to clipboard

Last modified timestamp changes before the file is updated

Open BashkirovN opened this issue 10 months ago • 1 comments

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.)

  1. Save the Last modified timestamp
  2. Overwrite the file
  3. Check if the Last modified timestamp has changed
  4. 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)

BashkirovN avatar Jan 27 '25 21:01 BashkirovN

You can use supabase webhooks they are much better for these instances.

ajitsinghkaler avatar Feb 04 '25 06:02 ajitsinghkaler

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

fenos avatar Jul 30 '25 09:07 fenos