Handling SurrealDB Token Expiration & Reconnection (Hono Example) #16
Replies: 1 comment
-
|
Hi @agentic-com ! Thanks for raising this and sharing your implementation. I want to clarify that That being said, the code you shared is a valuable reference for anyone looking for inspiration on how to handle reconnection logic at the application level, specifically within the Hono framework. It provides a solid foundation for developers to build upon. Thank you for sharing it. To keep this visible for the community as a "recipe" rather than a bug report, I will convert this Issue into a Discussion. This way, it serves as a helpful resource for others facing similar implementation challenges. Quick question: Do you feel the current documentation/README makes this distinction clear enough? I’d be happy to add a brief note clarifying that connection management is strictly the consumer's responsibility if you think the current wording is ambiguous. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you define a duration for your root authentication, the token you receive after connecting with
db.connect(…)will expire after that time. If not actualised, all your requests will beUnauthorised.I was experiencing a root token actualisation issue because the actual adapter doesn’t consider it. Consequently, I created my own token renewal logic and I’m sharing it here in case it helps someone else in the future or inspires @oskar-gmerek for future feature releases. It’s not perfect but it provides a basic understanding of how such a system works.
Beta Was this translation helpful? Give feedback.
All reactions