{"record":{"id":"7f4bbb9574e48972","repo":"chenhg5/cc-connect","slug":"cloud-web-public-url-is-required-when-register-ur","errorCode":null,"errorMessage":"cloud_web: public_url is required when register_url is set for gateway transport","messagePattern":"cloud_web: public_url is required when register_url is set for gateway transport","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/cloud-web/cloudweb.go","lineNumber":119,"sourceCode":"\t\tresolved := resolveWSURL(baseURL, wsURL)\n\t\tif strings.TrimSpace(resolved) == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cloud_web: ws_url or base_url is required for websocket transport\")\n\t\t}\n\t\ttp = newWSTransport(resolved, token, name, project)\n\tcase \"long_poll\":\n\t\tif strings.TrimSpace(baseURL) == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cloud_web: base_url is required for long_poll transport\")\n\t\t}\n\t\ttp = newPollTransport(baseURL, token, name, project, eventsPath, sendPath, longPollMS)\n\tcase \"gateway\":\n\t\tif strings.TrimSpace(baseURL) == \"\" && strings.TrimSpace(registerURL) != \"\" {\n\t\t\tbaseURL = deriveBaseURL(registerURL)\n\t\t}\n\t\tif strings.TrimSpace(baseURL) == \"\" && strings.TrimSpace(registerURL) == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cloud_web: base_url or register_url is required for gateway transport\")\n\t\t}\n\t\tif strings.TrimSpace(registerURL) != \"\" && strings.TrimSpace(publicURL) == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cloud_web: public_url is required when register_url is set for gateway transport\")\n\t\t}\n\t\ttp = newGatewayTransport(baseURL, token, name, project, listen, webhookPath, registerURL, publicURL, sendPath)\n\t}\n\n\treturn &Platform{\n\t\tname:           name,\n\t\tproject:        project,\n\t\ttoken:          token,\n\t\ttransportKind:  transportKind,\n\t\tallowFrom:      allowFrom,\n\t\tshareInChannel: shareInChannel,\n\t\tgroupReplyAll:  groupReplyAll,\n\t\ttp:             tp,\n\t\treplyCtxs:      make(map[string]string),\n\t}, nil\n}\n\nfunc pickInt(v any) int {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/cloud-web/cloudweb.go#L101-L137","documentation":"In gateway transport with webhook registration, the platform must expose a publicly reachable URL so the service can call back into it. New enforces that when register_url is provided, public_url must also be provided, otherwise registration would produce a webhook the service cannot reach.","triggerScenarios":"Calling New with transport = \"gateway\", a non-empty register_url, and an empty/whitespace public_url.","commonSituations":"Self-hosted deployments behind NAT or localhost where the admin set the register endpoint but no public hostname; tunnel (ngrok/cloudflared) URL not updated after a restart; forgetting public_url when migrating from long_poll to gateway transport.","solutions":["Add public_url to the gateway config with a publicly reachable HTTPS URL for this instance","Restart or re-run a tunnel (e.g. cloudflared) and update public_url with the new address","If no public URL is possible, switch transport to \"long_poll\" or \"websocket\", which do not require register_url/public_url"],"exampleFix":"// before\n[platform.cloud_web]\ntransport = \"gateway\"\nregister_url = \"https://cloud.example.com/webhook/register\"\n\n// after\n[platform.cloud_web]\ntransport = \"gateway\"\nregister_url = \"https://cloud.example.com/webhook/register\"\npublic_url = \"https://my-tunnel.example.com\"","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(cfg.RegisterURL) != \"\" && strings.TrimSpace(cfg.PublicURL) == \"\" {\n    return fmt.Errorf(\"cloud_web: public_url must accompany register_url\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always deploy gateway mode behind a stable public hostname/tunnel","Re-verify public_url after tunnel restarts (URLs often change)","Choose long_poll transport when no public inbound URL is available"],"tags":["config","cloud-web","gateway","webhook"],"backgroundTag":"missing-required-config-field","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}