ToolJet/ToolJet · error · QueryError
Connection test failed
Error message
Connection test failed
What it means
Thrown by the Authorize.Net plugin's testConnection when the SDK callback rejects (response.getResults().getResultCode() !== 'Ok') OR when any other error escapes the Promise wrapper. The inner branch already produces a QueryError with the API message text; the outer catch re-wraps anything else with error.message.
Source
Thrown at marketplace/plugins/authorizenet/lib/index.ts:38
const response = new ApiContracts.GetMerchantDetailsResponse(apiResponse);
if (response.getMessages().getResultCode() === ApiContracts.MessageTypeEnum.OK) {
resolve({
status: 'ok',
});
} else {
const errorMessage = response.getMessages().getMessage()[0].getText();
reject(
new QueryError(errorMessage, errorMessage, {
code: response.getMessages().getMessage()[0].getCode(),
message: errorMessage,
})
);
}
});
});
} catch (error: any) {
throw new QueryError('Connection test failed', error.message, {
message: error.message,
name: error.name,
});
}
}
async run(sourceOptions: SourceOptions, queryOptions: QueryOptions, dataSourceId: string): Promise<QueryResult> {
const { operation } = queryOptions;
if (!operation) {
throw new QueryError('Invalid configuration', 'Operation is required', {
message: 'Operation parameter is missing',
});
}
try {
let result: any;
switch (operation) {View on GitHub (pinned to 20602a8e10)
Solutions
- Verify apiLoginId and transactionKey in the Authorize.Net merchant interface and that they match the selected environment (sandbox vs production).
- Use the inner error's message/code (passed through when the SDK callback produces the QueryError) to diagnose the exact API rejection.
- Confirm network access and TLS trust store for api.authorize.net / apitest.authorize.net.
- Ensure the account is activated and the API integration is enabled.
Example fix
// before
throw new QueryError('Connection test failed', error.message, { message: error.message, name: error.name });
// after: preserve the SDK code when present for precise diagnostics
throw new QueryError('Connection test failed', error.message, { message: error.message, name: error.name, code: error.code ?? null }); Defensive patterns
Strategy: validation
Validate before calling
function hasAuthCredentials(s) {
return typeof s?.apiLoginId === 'string' && s.apiLoginId.trim().length > 0
&& typeof s?.transactionKey === 'string' && s.transactionKey.trim().length > 0;
} Type guard
function hasMerchantCreds(s: unknown): s is { apiLoginId: string; transactionKey: string } {
return typeof s === 'object' && s !== null
&& typeof (s as any).apiLoginId === 'string' && (s as any).apiLoginId.trim().length > 0
&& typeof (s as any).transactionKey === 'string' && (s as any).transactionKey.trim().length > 0;
} Try / catch
try {
await plugin.testConnection(sourceOptions);
} catch (e) {
if (e instanceof QueryError && e.message === 'Connection test failed') {
const code = e.data?.code;
// map known Authorize.Net codes (e.g. E00024 sandbox-only card) to user guidance
}
throw e;
} Prevention
- Match sandbox credentials with the sandbox endpoint and production with production.
- Trim credentials when storing; reject whitespace.
- Confirm the account is activated and API access enabled before testing.
When it happens
Trigger: API credentials (apiLoginId / transactionKey) are wrong or inactive — Authorize.Net returns a non-Ok result code with an error message and code, which the inner branch converts to a QueryError; the SDK throws before/after the callback (auth setup, network, cert); the Promise rejects for an unexpected reason that is then re-wrapped here.
Common situations: Sandbox credentials used against production endpoint or vice versa; transactionKey copied with extra whitespace; account not yet activated; egress firewall blocking api.authorize.net; clock skew rejecting the request.
Related errors
- Connection could not be established
- Invalid configuration
- Invalid operation
- Error refreshing access token
- Unknown resource
AI-assisted analysis of ToolJet/ToolJet@20602a8e10 (2026-08-13).
Data as JSON: /api/errors/0001acb2b7460d04.
Report an issue: GitHub.