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
[x] CI tests (if present) are passing
[x] Adheres to code style for repo
[x] Contributor License Agreement (CLA) completed if not a Reddit employee
💸 TL;DR
This PR introduces a new error for attempting to fetch a secret of the wrong type:
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 ofGetVersionedSecret
). This change would've avoided this whole situation.🧪 Testing Steps / Validation
Added a unit test.
✅ Checks