Skip to content

Commit 0d02999

Browse files
mpstatonclaude
andcommitted
ci(deploy-watch): print Railway's own error instead of guessing at the token type
The first live run failed on "Could not resolve environmentId from the token", which is the right guard but a dead end diagnostically — it reports what did not happen and swallows what Railway actually said. The response body carries the real message and contains no credential, so there was never a reason to hide it. Also captures the probe with `|| true`, because `curl -sSf` under `set -e` would abort the step on a non-2xx before the diagnostic could ever print — the failure mode most worth seeing was the one guaranteed to stay invisible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QwrqK15CtSW1sWAyEzopco
1 parent a06ae5a commit 0d02999

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/deploy-watch.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,19 @@ jobs:
6161
6262
# The token knows which environment it belongs to, so no Railway IDs
6363
# are committed here. Swapping the secret repoints the whole workflow.
64-
ENV_ID=$(api '{"query":"query { projectToken { environmentId } }"}' \
65-
| jq -r '.data.projectToken.environmentId')
66-
67-
if [ -z "$ENV_ID" ] || [ "$ENV_ID" = "null" ]; then
64+
# `|| true` so a non-2xx from curl -f still reaches the diagnostic
65+
# below instead of dying silently under `set -e`.
66+
PROBE=$(api '{"query":"query { projectToken { environmentId } }"}' || true)
67+
ENV_ID=$(printf '%s' "$PROBE" | jq -r '.data.projectToken.environmentId // empty')
68+
69+
if [ -z "$ENV_ID" ]; then
70+
# `projectToken` resolves ONLY for a project token. An account or
71+
# team token authenticates fine and returns null here, which is the
72+
# overwhelmingly likely cause. Print the response — it carries
73+
# Railway's own error message and contains no credential.
6874
echo "::error::Could not resolve environmentId from the token. Is it a PROJECT token?"
75+
echo "Railway response:"
76+
printf '%s\n' "$PROBE" | jq . 2>/dev/null || printf '%s\n' "$PROBE"
6977
exit 1
7078
fi
7179

0 commit comments

Comments
 (0)