Log why a Dataverse server rejected a token at connect - #280
Merged
Merged
Conversation
validateStaticToken collapsed every non-200 into "invalid", and the connect endpoint turns that into "Invalid API token" without logging anything. A real 401, a firewall 403, and an outage 5xx looked the same after the fact, which left #278 undiagnosable. Log the server, status, and a truncated, token-scrubbed body so the next failure says why. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Refs #278.
Why
When a researcher connects Dataverse,
validateStaticTokentreats any non-200 from/api/users/:meas an invalid token, and the connect endpoint reports "Invalid API token" without logging anything. A real 401, a firewall 403, and an outage 5xx all look the same afterward.For #278 (Harvard Dataverse), prod logs show about 20 failed connects on 2026-09-26 around when the issue was filed, but nothing about what Harvard returned. Harvard also returned 504s to our server the next morning.
What
[redacted].Follow-up
Once the logs show what Harvard returns, show a separate "couldn't reach the server" message for 5xx responses and network errors, instead of "did not accept the token".
🤖 Generated with Claude Code