API Key plugin is always returning a KEY_NOT_FOUND error
I've got some basic Hono middleware to check API keys:
I'm always getting a
KEY_NOT_FOUND
error, even when the key's valid. How should I fix this?
I've already run all migrations for the DB.Solution:Jump to solution
Here's the fix, for those interested:
```diff
apiKey({
customKeyGenerator: async () => {
return crypto.randomUUID();...
3 Replies
Here's the repo: https://github.com/skyfallWasTaken/quackatime/
And here's the Hono server: https://github.com/SkyfallWasTaken/quackatime/blob/main/src/routes/api/index.ts
GitHub
GitHub - SkyfallWasTaken/quackatime: A self-hostable time tracking ...
A self-hostable time tracking server for WakaTime. - SkyfallWasTaken/quackatime
GitHub
quackatime/src/routes/api/index.ts at main · SkyfallWasTaken/quack...
A self-hostable time tracking server for WakaTime. - SkyfallWasTaken/quackatime
And here's the full error that Better Auth returns:
Strangely enough, I get the same error even if I create an API key and use it straight after:
Looks like I'm triggering this check
Solution
Here's the fix, for those interested: