{"record":{"id":"7959be06bb482f4d","repo":"chenhg5/cc-connect","slug":"cloud-web-gateway-mode-requires-base-url-for-outb","errorCode":null,"errorMessage":"cloud_web: gateway mode requires base_url for outbound send","messagePattern":"cloud_web: gateway mode requires base_url for outbound send","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/cloud-web/gateway.go","lineNumber":265,"sourceCode":"\t\tt.previewMu.Unlock()\n\t\tif ok {\n\t\t\tch <- ack.PreviewHandle\n\t\t}\n\tcase \"capabilities_changed\":\n\t\tvar ch wireCapabilitiesChanged\n\t\tif err := json.Unmarshal(raw, &ch); err == nil && len(ch.Capabilities) > 0 {\n\t\t\tt.setCaps(capabilitySet(ch.Capabilities))\n\t\t}\n\tdefault:\n\t\tif t.onInbound != nil {\n\t\t\tt.onInbound(raw)\n\t\t}\n\t}\n}\n\nfunc (t *gatewayTransport) Send(ctx context.Context, msg map[string]any) error {\n\tif t.baseURL == \"\" {\n\t\treturn fmt.Errorf(\"cloud_web: gateway mode requires base_url for outbound send\")\n\t}\n\tbody, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\turl := joinURL(t.baseURL, t.sendPath)\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tauthHTTP(req, t.token)\n\tresp, err := t.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\traw, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/cloud-web/gateway.go#L247-L283","documentation":"An outbound message was sent through a cloud-web platform running in gateway mode, but no base_url is configured, so the transport has no upstream server to POST the message to. Gateway mode receives inbound events via its own listener; sending messages back still requires the address of the cloud-web server. This is a configuration error raised before any network I/O.","triggerScenarios":"Engine calls Send on the cloud-web platform while the platform section in config.toml omits base_url (or it is empty/whitespace) and mode is gateway.","commonSituations":"Config written for webhook-only inbound delivery without the outbound base_url field; base_url removed during a config refactor; environment-specific config file missing the field.","solutions":["Add base_url to the cloud-web platform section of config.toml pointing at the cloud-web server (e.g. \"https://cloud.example.com\").","If the deployment is intentionally receive-only, don't route outbound messages through this platform.","Restart cc-connect after adding the field; the value is read at transport construction.","Verify no stray whitespace-only value like base_url = \" \" — it is trimmed and still treated as empty."],"exampleFix":"// config.toml — before\n[[platform]]\nname = \"cloud-web\"\nmode = \"gateway\"\nlisten = \":8099\"  # no base_url -> Send fails\n\n// after\n[[platform]]\nname = \"cloud-web\"\nmode = \"gateway\"\nlisten = \":8099\"\nbase_url = \"https://cloud.example.com\"","handlingStrategy":"validation","validationCode":"// validate config before constructing the platform\nif mode == \"gateway\" {\n    if strings.TrimSpace(baseURL) == \"\" {\n        return errors.New(\"cloud-web gateway mode requires a non-empty base_url for outbound send\")\n    }\n    if u, err := url.Parse(baseURL); err != nil || u.Scheme == \"\" || u.Host == \"\" {\n        return fmt.Errorf(\"invalid base_url %q\", baseURL)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := platform.Send(ctx, msg); err != nil {\n    if strings.Contains(err.Error(), \"requires base_url\") {\n        slog.Error(\"cloud-web gateway has no base_url; add it to config.toml and restart\")\n        return err\n    }\n    return err\n}","preventionTips":["Always set base_url when using gateway mode, even if inbound is via webhook","Add a config linter/startup check that requires base_url for cloud-web platforms","Keep environment config templates in sync so the field is never dropped","Trim-check the value: a whitespace-only base_url behaves as empty"],"tags":["configuration","cloud-web","missing-config"],"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-14T05:17:10.506Z"}