{"record":{"id":"742fdf8ec863d56c","repo":"odoo/odoo","slug":"failed-to-connect-to-odoo-peppol-proxy","errorCode":null,"errorMessage":"Failed to connect to Odoo Peppol Proxy.","messagePattern":"Failed to connect to Odoo Peppol Proxy\\.","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"addons/account_peppol/tools/peppol_iap_connector.py","lineNumber":41,"sourceCode":"        self.env = company.env\n        proxy_mode = company._get_peppol_edi_mode()\n        assert proxy_mode in ('prod', 'test')\n        self.proxy_mode = proxy_mode\n        self.base_url = PEPPOL_PROXY_URLS[proxy_mode]\n\n    def request_public_http(self, method, endpoint, data=None, params=None):\n        headers = {'Content-Type': 'application/json'}\n        url = urljoin(self.base_url, endpoint)\n        response_vals = {}\n        try:\n            response = requests.request(method, url, json=data, params=params, timeout=TIMEOUT, headers=headers)\n            response_vals = response.json()\n            response.raise_for_status()\n        except requests.exceptions.RequestException as e:\n            if response_vals and 'code' in response_vals:\n                raise UserError(get_peppol_error_message(self.env, response_vals))\n            _logger.debug(\"Failed to connect to Odoo Peppol Proxy %s, %s\", endpoint, e)\n            raise UserError(self.env._(\"Failed to connect to Odoo Peppol Proxy.\"))\n        return response_vals\n\n    def can_connect(self, *, peppol_identifier, db_uuid, callback_url, connect_token, contact_email=None, webhook_url=None):\n        return self.request_public_http('GET', '/api/peppol/2/can_connect', params={\n            'dbuuid': db_uuid,\n            'peppol_identifier': peppol_identifier,\n            'callback_url': callback_url,\n            'connect_token': connect_token,\n            'contact_email': contact_email,\n            'webhook_url': webhook_url,\n        })\n\n    def create_connection(self, *, peppol_identifier, db_uuid, public_key, auth_token=None, **company_details):\n        params = {\n            'peppol_identifier': peppol_identifier,\n            'dbuuid': db_uuid,\n            'company_id': self.company.id,\n            'public_key': public_key,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/odoo/odoo/blob/1e661df964b1b264c9cef3ab28430d4785be3fda/addons/account_peppol/tools/peppol_iap_connector.py#L23-L59","documentation":"UserError from PeppolIAPConnector.request_public_http (peppol_iap_connector.py:41): the requests call to the Peppol proxy endpoint failed at the transport level (DNS failure, connection refused, TLS error, timeout after TIMEOUT=10s, non-JSON response, or an HTTP error status whose body has no 'code' key). With no structured error payload to surface, Odoo raises the generic 'Failed to connect to Odoo Peppol Proxy.' and logs details at DEBUG level.","triggerScenarios":"Any request_public_http call (can_connect during registration/verification, or other public endpoints) when the server cannot be reached or responds unparseably: network outage, firewall blocking peppol.api.odoo.com/peppol.test.odoo.com, corporate proxy/DNS misconfig, slow response exceeding the 10-second timeout, or the proxy returning an HTML error page.","commonSituations":"On-premise servers behind restrictive firewalls; Docker containers without outbound internet; self-hosted setups with broken DNS; transient proxy downtime; responses >10s (slow networks) hitting requests timeout; captive portals in datacenters.","solutions":["From the Odoo host, verify connectivity: curl -v https://peppol.api.odoo.com (and the test URL if in test mode).","Open outbound HTTPS (443) to peppol.api.odoo.com / peppol.test.odoo.com in firewall/proxy rules; configure HTTP(S)_PROXY for the Odoo process if a corporate proxy is required.","Retry after transient failures — the failure is transport-level, and registration can simply be re-attempted.","Enable debug logging for the 'odoo.addons.account_peppol' logger to see the underlying exception ('Failed to connect to Odoo Peppol Proxy %s, %s' is logged at DEBUG)."],"exampleFix":"# shell diagnosis\n# before: UserError 'Failed to connect to Odoo Peppol Proxy.'\ncurl -v --max-time 10 https://peppol.api.odoo.com/api/peppol/2/can_connect","handlingStrategy":"retry","validationCode":"import socket\nfrom urllib.parse import urlparse\n\ndef proxy_reachable(base_url, timeout=5):\n    host = urlparse(base_url).hostname\n    try:\n        socket.create_connection((host, 443), timeout=timeout).close()\n        return True\n    except OSError:\n        return False\n\nif not proxy_reachable(connector.base_url):\n    return defer_with_warning('Peppol proxy unreachable; will retry later')","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        return connector.request_public_http(method, endpoint, params=params)\n    except UserError as e:\n        if 'Failed to connect' not in str(e) or attempt == 2:\n            raise","preventionTips":["Allow outbound 443 to peppol.api.odoo.com / peppol.test.odoo.com in firewalls.","Configure HTTP(S)_PROXY for Odoo behind corporate proxies.","Wrap connector calls in scheduled jobs that retry on transport failure."],"tags":["peppol","network","timeout","connectivity","odoo"],"backgroundTag":null,"analyzedSha":"1e661df964b1b264c9cef3ab28430d4785be3fda","analyzedAt":"2026-08-15T05:22:16.142Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}