Repository navigation
fix(tts-audio): name the real cause of a rejected Admin key - #281
Merged
Merged
Conversation
added 2 commits
November 27, 2026 06:54
The deployed cluster has no `sredevops-audio` bucket; the real one is `tts-sredevopsorg` in project `sredevopsorg`. The service account has object access to it (verified: list, upload, delete all succeed), so the ConfigMap was the only thing wrong — but it was wrong in four places, and a job would have synthesised for ~20 minutes and then failed on upload. - base/configmap.yaml GCS_BUCKET, the Makefile's GCP_PROJECT/GCS_BUCKET defaults, and scripts/cors.sh - README: document the defaults, note that gcp-bootstrap needs a principal that can administer the bucket (the runner SA deliberately cannot), and name the three ways a pipeline looks deployed but produces nothing audible — wrong bucket, objects not public, CORS not applied — with the two curl checks that catch them. Verified end to end against the real bucket with the real model: the job synthesised, encoded, uploaded gs://tts-sredevopsorg/audio/... and wrote the marker, with contentType audio/mpeg and the immutable Cache-Control.
The backfill died with "listing posts failed: Ghost 400 Bad Request" while Ghost's body said `INVALID_JWT` — the Admin API key is not valid on this instance. The runbook's debugging section is about buckets and routing, so that message sent the operator to the wrong place. - backfill's listing now keeps Ghost's error code, names the failed key id, and says what to do (repair the integration, regenerate, update the Secret). - the same hint is added to the shared client, since a job's very first call is this request. - a listing failure is logged and ends the run as a structured `failed` line instead of escaping as an uncaught exception. - README: how to tell a valid key from a revoked one. `/site/` answers 200 *without auth*, so it proves nothing; compare a protected endpoint against a deliberately wrong key instead. 403 = no key, 400 INVALID_JWT = key rejected. Verified against the live endpoint with the reported key: it now prints "Ghost 400 INVALID_JWT — the Admin API key was rejected (key id 6b0934...)" and exits 1 with a JSON line.
ngeorger
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The error is the Admin API key, not the code
The backfill died on its first request:
Ghost's response body said
INVALID_JWT, butlistPoststhrew away the body and reported onlystatusText. That sent you looking at buckets and routing — the runbook's debugging section — when the answer was one line up.Proof it is the key
Calling the live instance directly:
GET /ghost/api/admin/settings/6b093438…INVALID_JWTINVALID_JWTAuthorizationheaderYour key behaves identically to garbage: Ghost treats it as not a key. And the
/site/call I used earlier to say "the key works" was worthless —/site/returns 200 with no auth at all. I should have tested an endpoint that requires an integration. That was my error, not a change on your side.Fix on your side: Ghost Admin → Integrations → find/create
tts-audio→ make sure it has the Administrator role (needed to writecodeinjection_foot) → copy its new Admin API key →make secret ADMIN_KEY='<id>:<secret>' …→make restart.What this PR changes
backfill.mjskeeps Ghost's error code, names the failed key id, and says what to do.ghost.mjsadds the same hint — a job's very first call is this request.{"result":"failed"}line instead of escaping as an uncaught exception.curls and the 403-vs-400 distinction.Verified against the live endpoint with your key:
Gates
deploy/tts-audio/test.sh✅ (70 worker tests, two new for the auth path) ·yarn verify✅Reminder
This key, the webhook secret and the GCS service-account key have all been pasted into chat more than once. Rotate them.