{"record":{"id":"b4d82cd1adacfb49","repo":"Budibase/budibase","slug":"connection-refused-when-using-proxy-check-proxy-c","errorCode":null,"errorMessage":"Connection refused when using proxy. Check proxy configuration and ensure the proxy server is accessible. Original error: ${error.message}","messagePattern":"Connection refused when using proxy\\. Check proxy configuration and ensure the proxy server is accessible\\. Original error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/rest.ts","lineNumber":1010,"sourceCode":"        cause: error.cause?.message,\n        code: error.cause?.code,\n        hasDispatcher,\n        usedProxyDispatcher,\n        isHttpsUrl: url.startsWith(\"https://\"),\n        rejectUnauthorized,\n      })\n      if (\n        error.cause?.code === \"UNABLE_TO_VERIFY_LEAF_SIGNATURE\" ||\n        error.cause?.code === \"CERT_UNTRUSTED\" ||\n        error.cause?.code === \"SELF_SIGNED_CERT_IN_CHAIN\"\n      ) {\n        throw new Error(\n          `SSL certificate verification failed for ${url}. Consider setting rejectUnauthorized to false if using self-signed certificates. Original error: ${error.message}`\n        )\n      }\n\n      if (error.cause?.code === \"ECONNREFUSED\" && usedProxyDispatcher) {\n        throw new Error(\n          `Connection refused when using proxy. Check proxy configuration and ensure the proxy server is accessible. Original error: ${error.message}`\n        )\n      }\n      throw error\n    }\n    if (response.status === 401 && retry401) {\n      const { authConfigId, authConfigType } = query\n      if (authConfigType === RestAuthType.OAUTH2 && authConfigId) {\n        await sdk.oauth2.cleanStoredTokensForAuthConfig(authConfigId)\n        return await this._req(query, { ...opts, retry401: false })\n      }\n    }\n    const parsed = await this.parseResponse(response, pagination)\n    if (includeRequest) {\n      const request = this.buildRequestPreview(built, opts)\n      if (request) {\n        parsed.extra = {\n          raw: undefined,","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/rest.ts#L992-L1028","documentation":"The REST integration's fetch call failed with an ECONNREFUSED cause while a proxy dispatcher was in use. The integration wraps the underlying undici error to indicate the refusal happened through the configured proxy, distinguishing it from a direct connection failure. It is thrown so the user knows to inspect proxy settings rather than the target URL.","triggerScenarios":"Executing a REST query (RestIntegration) with a proxy configured (usedProxyDispatcher set) where the proxy host is down, the port is wrong, or the proxy refuses the connection (error.cause?.code === 'ECONNREFUSED').","commonSituations":"PROXY env var or integration proxy config pointing at a stopped local proxy (e.g. mitm/charles not running); corporate proxy decommissioned or IP changed; typo in proxy port; container networking where the proxy hostname is unreachable from the server process; proxy crashed under load.","solutions":["Verify the proxy server is running and reachable: curl -x http://<proxy-host>:<proxy-port> https://example.com from the server host.","Check the proxy configuration (environment variables like HTTP_PROXY/HTTPS_PROXY or the integration's proxy settings) for typos in host/port and correct them.","If no proxy is needed, remove the proxy configuration so requests go direct.","Confirm firewall/security-group rules allow the Budibase server to reach the proxy port.","Check proxy service logs and restart it if it crashed."],"exampleFix":"// before (env pointing at dead proxy)\nHTTPS_PROXY=http://127.0.0.1:8888 yarn dev\n// after (corrected running proxy, or removed)\nHTTPS_PROXY=http://127.0.0.1:9090 yarn dev  # or unset HTTPS_PROXY","handlingStrategy":"try-catch","validationCode":"const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY\nif (proxyUrl) {\n  const { hostname, port } = new URL(proxyUrl)\n  const net = await import(\"node:net\")\n  await new Promise((res, rej) => {\n    const s = net.connect(Number(port), hostname, () => { s.destroy(); res(null) })\n    s.on(\"error\", rej)\n  })\n}","typeGuard":"function isProxyRefused(err: unknown): err is Error & { cause?: { code?: string } } {\n  return err instanceof Error &&\n    err.message.includes(\"Connection refused when using proxy\") &&\n    (err.cause as { code?: string } | undefined)?.code === \"ECONNREFUSED\"\n}","tryCatchPattern":"try {\n  await restIntegration.read(query)\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Connection refused when using proxy\")) {\n    // fall back to direct connection or alert on proxy health\n  } else { throw err }\n}","preventionTips":["Health-check the proxy endpoint before configuring it in the integration","Keep proxy env vars (HTTP_PROXY/HTTPS_PROXY/NO_PROXY) accurate per environment","Monitor proxy service uptime and set NO_PROXY for internal hosts","Pin and test proxy config changes in staging before production"],"tags":["network","proxy","rest-integration","connection"],"backgroundTag":"proxy-connection-refused","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}