JacobLinCool / JacobLinCool/d1-manager

Better errors for when secrets (POLICY_AUD, etc) are not set

Open
#81 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Svelte
Stars
645
Forks
335
PR merge metrics
No merged PRs in 30d

Description

Depending on what isn't set, you get some mysterious errors that takes a while to figure out by trawling the server logs.

- `TEAM_DOMAIN` not set -> `401 Authentication error`
- `POLICY_AUD` not set -> 500 error / `[Auth] JWT validation failed: unexpected "aud" claim value`
- `ACCOUNT_ID` or `API_KEY` not set -> `API error: 500` / `Error: Failed to list databases: 404`

Why not check if these are set before doing anything and show an error for each? e.g.

`Error: TEAM_DOMAIN env/secret not set`

Bonus: As well as the error, link to docs such as: https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are named. Start by tracing where TEAM_DOMAIN, POLICY_AUD, ACCOUNT_ID, and API_KEY are read before authentication and database/API requests; done means each missing secret produces a clear named error and includes the relevant documentation link.

Written by the indexing model from the issue text.

Assessment

Domain
api, authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.