phacility/phabricator · error · PhutilProxyException

Expected valid JSON response from Amazon account data…

Error message

Expected valid JSON response from Amazon account data request.

What it means

Raised in the Amazon OAuth adapter when the HTTPS request to api.amazon.com/user/profile succeeds but phutil_json_decode() cannot parse the response body as JSON. The original parse exception is wrapped in a PhutilProxyException; the culprit is a malformed, HTML error page, or otherwise non-JSON response from Amazon.

Solutions

  1. Retry the login; transient gateway errors often produce non-JSON bodies
  2. Inspect phabricator logs to see the raw response body returned by Amazon
  3. Verify the Amazon OAuth credentials and API endpoint are still valid
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/applications/auth/adapter/PhutilAmazonAuthAdapter.php:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/c32ebd4bffa24993. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/auth/adapter/PhutilAmazonAuthAdapter.php:74

  }

  public function getExtraTokenParameters() {
    return array(
      'grant_type' => 'authorization_code',
    );
  }

  protected function loadOAuthAccountData() {
    $uri = new PhutilURI('https://api.amazon.com/user/profile');
    $uri->replaceQueryParam('access_token', $this->getAccessToken());

    $future = new HTTPSFuture($uri);
    list($body) = $future->resolvex();

    try {
      return phutil_json_decode($body);
    } catch (PhutilJSONParserException $ex) {
      throw new PhutilProxyException(
        pht('Expected valid JSON response from Amazon account data request.'),
        $ex);
    }
  }

}

View on GitHub (pinned to 5720a38cfe)