Repository navigation
now-sdk query treats HTTP 200 login HTML as JSON and hides authentication failure (SDK 4.11.0) #120
Unanswered
csuiter
asked this question in
Help and Questions with SDK or Fluent
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
In SDK 4.11.0,
Connector.queryTable()treats any HTTP 2xx response as Table API JSON. If an instance or authentication layer returns an HTML login/session page with HTTP 200, the SDK callsresponse.json()and surfaces an opaque parser error:This is difficult to diagnose in CI and scheduled automation because it looks like malformed instance data rather than an expired session or unexpected authentication response.
Environment
@servicenow/sdk: 4.11.0Minimal reproduction
Actual behavior
queryTable()throws the raw JSON parser error shown above.The 4.11.0 implementation checks
response.ok, but for successful HTTP status codes it callsresponse.json()without first validating the response content type or wrapping JSON parse failures with Table API context.Expected behavior
The SDK should detect a non-JSON response and return an actionable, sanitized error, for example:
The diagnostic should include the HTTP status, content type, and table/endpoint context, but should not echo the HTML response body because it could contain instance or authentication details.
Suggested resolution
Content-Typebefore parsing successful Table API responses.SyntaxError.I searched the existing SDK Discussions and did not find a matching report.
All reactions