unkeyed / unkey

Open source API management platform

Home Page:https://go.unkey.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle database error when inserting a duplicate `hash` in the `keys` table

chronark opened this issue · comments

Preliminary Checks

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

go for it

I was sure it gave an internal server error but I am not able to reproduce that anymore. Maybe I was wrong. It shows proper message when entered duplicate keys or hash.
image