reddit / baseplate.go

Reddit's Service Framework in Go
https://pkg.go.dev/github.com/reddit/baseplate.go
BSD 3-Clause "New" or "Revised" License
90 stars 76 forks source link

Introduce an error for trying to fetch a secret of the wrong type. #642

Closed folone closed 7 months ago

folone commented 7 months ago

💸 TL;DR

This PR introduces a new error for attempting to fetch a secret of the wrong type:

secrets: requested secret at path 'secret/myservice/external-account-key' of type 'simple' does not exist, but a secret of type 'versioned' does. Consider using the correct API to retrieve the secret

I've seen this issue recently, and had a few infra folks trying to debug why secrets are not being fetched. Turned out they were, but I was using the wrong API (GetSimpleSecret instead of GetVersionedSecret). This change would've avoided this whole situation.

🧪 Testing Steps / Validation

Added a unit test.

✅ Checks