You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rc-entitlement-drift-check): use REVENUECAT_SECRET_API_KEY_V2 (#66)
RC v1 secret keys are rejected by the v2 customer/entitlement endpoints
with a 403. Splitting the env var so delete-account keeps using its v1
key on /v1/subscribers and rc-entitlement-drift-check uses a separately
issued v2 key with customer_information:customers:read and
customer_information:entitlements:read scopes.
Surfaced during the first manual smoke test of the cron job (PR #60);
returned 500 with rc_list_entitlements_403 in the function logs.
Docs updated (payments.md, edge-functions.md, deployment.md) so operators
issue a separate v2 key during first-time setup.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|`REVENUECAT_SECRET_API_KEY`| Admin API key (used by `delete-account` and `rc-entitlement-drift-check`) |
54
+
|`REVENUECAT_SECRET_API_KEY`| RC v1 secret key (used by `delete-account` only) |
55
+
|`REVENUECAT_SECRET_API_KEY_V2`| RC v2-scoped secret key (used by `rc-entitlement-drift-check`). Issue separately in RC dashboard with `customer_information:customers:read` + `customer_information:entitlements:read` scopes. |
55
56
|`REVENUECAT_PROJECT_ID`| RC project id (used by `rc-entitlement-drift-check`) |
56
57
|`RC_DRIFT_CHECK_INVOKE_SECRET`| Bearer for pg_cron → `rc-entitlement-drift-check`; must mirror `vault.secrets.rc_drift_check_invoke_secret`. See `docs/payments.md` → "Drift Health Check" for the first-time setup and rotation runbook. |
@@ -205,7 +212,8 @@ The cron job will start firing at the next `:17 mod 6h` UTC mark.
205
212
206
213
-**Edge Function secrets** (set via dashboard or CLI):
207
214
-`REVENUECAT_WEBHOOK_SECRET` — must match the Bearer token configured in RevenueCat webhook settings
208
-
-`REVENUECAT_SECRET_API_KEY` — RC v2 REST API key, used by `delete-account` and `rc-entitlement-drift-check`
215
+
-`REVENUECAT_SECRET_API_KEY` — RC **v1** secret key, used by `delete-account` against `/v1/subscribers`
216
+
-`REVENUECAT_SECRET_API_KEY_V2` — RC **v2**-scoped secret key (separate from the v1 key), used by `rc-entitlement-drift-check` against `/v2/projects/...` endpoints. Required scopes: `customer_information:customers:read`, `customer_information:entitlements:read`.
209
217
-`REVENUECAT_PROJECT_ID` — RC project id, used by `rc-entitlement-drift-check`
210
218
-`RC_DRIFT_CHECK_INVOKE_SECRET` — Bearer for pg_cron → `rc-entitlement-drift-check`; must mirror `vault.secrets.rc_drift_check_invoke_secret`
211
219
-`SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` — auto-injected, no manual setup needed
@@ -225,7 +233,8 @@ The cron job will start firing at the next `:17 mod 6h` UTC mark.
225
233
|`EXPO_PUBLIC_REVENUECAT_API_KEY`|`.env` + EAS secrets | RevenueCat Apple API key, read at build time |
226
234
|`EXPO_PUBLIC_REVENUECAT_GOOGLE_API_KEY`|`.env` + EAS secrets | RevenueCat Google API key, read at build time |
227
235
|`REVENUECAT_WEBHOOK_SECRET`| Supabase Edge Function secrets | Webhook auth, server-side only |
228
-
|`REVENUECAT_SECRET_API_KEY`| Supabase Edge Function secrets | RC v2 REST API admin key (`delete-account`, `rc-entitlement-drift-check`) |
236
+
|`REVENUECAT_SECRET_API_KEY`| Supabase Edge Function secrets | RC v1 secret key (`delete-account` only — used against `/v1/subscribers`) |
237
+
|`REVENUECAT_SECRET_API_KEY_V2`| Supabase Edge Function secrets | RC v2-scoped secret key (`rc-entitlement-drift-check` — used against `/v2/projects/...` endpoints). Required scopes: `customer_information:customers:read`, `customer_information:entitlements:read`. |
229
238
|`REVENUECAT_PROJECT_ID`| Supabase Edge Function secrets | RC project id, used by `rc-entitlement-drift-check`|
230
239
|`RC_DRIFT_CHECK_INVOKE_SECRET`| Supabase Edge Function secrets **and** Supabase Vault | Bearer that pg_cron uses to invoke `rc-entitlement-drift-check`; rotate in both places together |
0 commit comments