Handle database error when inserting a duplicate `hash` in the `keys` table
chronark opened this issue · comments
Preliminary Checks
-
I have reviewed the documentation: https://unkey.com/docs
-
I have searched for existing issues: https://github.com/unkeyed/unkey/issues
-
This issue is not a question, general help request, or anything other than a bug report directly related to Unkey. Please ask questions in our Discord community: https://unkey.com/discord.
Reproduction / Replay Link (Optional)
No response
Issue Summary
Right now we fail and dump the db error
Steps to Reproduce
insert the same hash twice
Expected behavior
It should regenerate the key and try again to avoid the colission
Other information
No response
Screenshots
No response
Version info
- OS:
- Node:
- npm:
In the case of migrating duplicate keys, I believe it should not regenerate the key.
Yes, this is for generating keys, not migrating
But in case of migrating, will it not be a good idea to show some error message rather than internal server error?
It would
It would
May I give it a try?
go for it