{"record":{"id":"0001acb2b7460d04","repo":"ToolJet/ToolJet","slug":"connection-test-failed","errorCode":null,"errorMessage":"Connection test failed","messagePattern":"Connection test failed","errorType":"exception","errorClass":"QueryError","httpStatus":null,"severity":"error","filePath":"marketplace/plugins/authorizenet/lib/index.ts","lineNumber":38,"sourceCode":"          const response = new ApiContracts.GetMerchantDetailsResponse(apiResponse);\n\n          if (response.getMessages().getResultCode() === ApiContracts.MessageTypeEnum.OK) {\n            resolve({\n              status: 'ok',\n            });\n          } else {\n            const errorMessage = response.getMessages().getMessage()[0].getText();\n            reject(\n              new QueryError(errorMessage, errorMessage, {\n                code: response.getMessages().getMessage()[0].getCode(),\n                message: errorMessage,\n              })\n            );\n          }\n        });\n      });\n    } catch (error: any) {\n      throw new QueryError('Connection test failed', error.message, {\n        message: error.message,\n        name: error.name,\n      });\n    }\n  }\n\n  async run(sourceOptions: SourceOptions, queryOptions: QueryOptions, dataSourceId: string): Promise<QueryResult> {\n    const { operation } = queryOptions;\n\n    if (!operation) {\n      throw new QueryError('Invalid configuration', 'Operation is required', {\n        message: 'Operation parameter is missing',\n      });\n    }\n    try {\n      let result: any;\n\n      switch (operation) {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/ToolJet/ToolJet/blob/20602a8e101f2e59686c9afde0d1402aac2c8871/marketplace/plugins/authorizenet/lib/index.ts#L20-L56","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nthrow new QueryError('Connection test failed', error.message, { message: error.message, name: error.name });\n// after: preserve the SDK code when present for precise diagnostics\nthrow new QueryError('Connection test failed', error.message, { message: error.message, name: error.name, code: error.code ?? null });","handlingStrategy":"validation","validationCode":"function hasAuthCredentials(s) {\n  return typeof s?.apiLoginId === 'string' && s.apiLoginId.trim().length > 0\n      && typeof s?.transactionKey === 'string' && s.transactionKey.trim().length > 0;\n}","typeGuard":"function hasMerchantCreds(s: unknown): s is { apiLoginId: string; transactionKey: string } {\n  return typeof s === 'object' && s !== null\n    && typeof (s as any).apiLoginId === 'string' && (s as any).apiLoginId.trim().length > 0\n    && typeof (s as any).transactionKey === 'string' && (s as any).transactionKey.trim().length > 0;\n}","tryCatchPattern":"try {\n  await plugin.testConnection(sourceOptions);\n} catch (e) {\n  if (e instanceof QueryError && e.message === 'Connection test failed') {\n    const code = e.data?.code;\n    // map known Authorize.Net codes (e.g. E00024 sandbox-only card) to user guidance\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["authorizenet","connection-test","auth","config"],"backgroundTag":null,"analyzedSha":"20602a8e101f2e59686c9afde0d1402aac2c8871","analyzedAt":"2026-08-13T05:58:54.221Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}