When a call is made to the backend, the following high-level steps are performed: 1. Authenticate the user using clerk auth() 2. Read from the database. 3. Backend performs its operation. 4. Write results to the database. 5. Return.
For step 3, short-running tasks (<30s) work perfectly. Longer tasks (currently ranging up to 5-6 minutes), throw an error at step 4.
Upload a file to object storage: “Error: Storage upload failed: "exp" claim timestamp check failed” Write to a table in the database: “Error: Failed to add message: JWT expired”
Through our testing, we have verified that Supabase is using an expired token during its final write. We tried instantiating a new Supabase client for the final write and it ends up using the same token. Is there a way to refresh this token from the server? Is there a way to increase this token’s timeout? Is there another way around this problem?
We would appreciate any information or guidance with regards to this issue. Please let me know if there is any more information I can provide. Thank you!
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.