debug(cloudflare): add detailed logging for tunnel creation failures
This commit is contained in:
@@ -440,10 +440,14 @@ async def start_instance(
|
|||||||
tunnel_info["public_url"],
|
tunnel_info["public_url"],
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.exception(
|
import traceback
|
||||||
"Failed to create tunnel for instance %s: %s. Falling back to proxy URL.",
|
error_msg = str(exc)
|
||||||
|
error_trace = traceback.format_exc()
|
||||||
|
logger.error(
|
||||||
|
"Failed to create tunnel for instance %s: %s\nTraceback:\n%s",
|
||||||
instance.id,
|
instance.id,
|
||||||
exc,
|
error_msg,
|
||||||
|
error_trace,
|
||||||
)
|
)
|
||||||
instance.url = f"/instances/{instance.id}/proxy/"
|
instance.url = f"/instances/{instance.id}/proxy/"
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
|||||||
@@ -43,13 +43,17 @@ async def create_tunnel(
|
|||||||
if settings is None:
|
if settings is None:
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
|
logger.info("Settings loaded: api_token=%s, account_id=%s, zone_id=%s, base_domain=%s",
|
||||||
|
"set" if settings.cloudflare_api_token else "NOT SET",
|
||||||
|
settings.cloudflare_account_id or "NOT SET",
|
||||||
|
settings.cloudflare_zone_id or "NOT SET",
|
||||||
|
settings.cloudflare_base_domain or "NOT SET")
|
||||||
|
|
||||||
if not settings.cloudflare_api_token:
|
if not settings.cloudflare_api_token:
|
||||||
raise ValueError("CLOUDFLARE_API_TOKEN not configured")
|
raise ValueError("CLOUDFLARE_API_TOKEN not configured")
|
||||||
|
|
||||||
logger.info("Creating Cloudflare tunnel for instance_name=%s, instance_id=%s, port=%d",
|
logger.info("Creating Cloudflare tunnel for instance_name=%s, instance_id=%s, port=%d",
|
||||||
instance_name, instance_id, instance_port)
|
instance_name, instance_id, instance_port)
|
||||||
logger.info("Cloudflare config: account_id=%s, zone_id=%s, base_domain=%s",
|
|
||||||
settings.cloudflare_account_id, settings.cloudflare_zone_id, settings.cloudflare_base_domain)
|
|
||||||
|
|
||||||
headers = _get_headers(settings)
|
headers = _get_headers(settings)
|
||||||
account_id = settings.cloudflare_account_id
|
account_id = settings.cloudflare_account_id
|
||||||
|
|||||||
Reference in New Issue
Block a user