{"record":{"id":"a28599795249012f","repo":"microsoft/aspire","slug":"at-least-one-gateway-endpoint-http-or-https-must-be-provided","errorCode":null,"errorMessage":"At least one gateway endpoint (HTTP or HTTPS) must be provided.","messagePattern":"At least one gateway endpoint \\(HTTP or HTTPS\\) must be provided\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Blazor/GatewayConfigurationBuilder.cs","lineNumber":272,"sourceCode":"        {\n            [\"webAssembly\"] = new JsonObject\n            {\n                [\"environment\"] = environment\n            }\n        };\n\n        var json = config.ToJsonString(s_jsonOptions);\n\n        // The only literal { } in the output are structural JSON braces (we control\n        // all string values and they contain no braces). Escape them for string.Format,\n        // then swap the origin token for {0}.\n        var format = json\n            .Replace(\"{\", \"{{\")\n            .Replace(\"}\", \"}}\")\n            .Replace(OriginToken, \"{0}\");\n\n        var originEndpoint = httpsEndpoint ?? httpEndpoint\n            ?? throw new InvalidOperationException(\"At least one gateway endpoint (HTTP or HTTPS) must be provided.\");\n\n        var originRef = new GatewayOriginReference(originEndpoint);\n        var builder = new ReferenceExpressionBuilder();\n        var segments = format.Split(\"{0}\");\n        for (var i = 0; i < segments.Length; i++)\n        {\n            if (i > 0)\n            {\n                builder.AppendFormatted(originRef);\n            }\n            builder.AppendLiteral(segments[i]);\n        }\n\n        return builder.Build();\n    }\n}\n","sourceCodeStart":254,"sourceCodeEnd":289,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Blazor/GatewayConfigurationBuilder.cs#L254-L289","documentation":"GatewayConfigurationBuilder.BuildConfigExpression generates the YARP/proxy configuration template and needs an origin endpoint to substitute for the origin token. This error is thrown when neither an HTTPS nor an HTTP gateway endpoint was supplied to the builder. Without an origin, no valid proxy configuration can be emitted.","triggerScenarios":"Calling EmitProxyConfiguration or EmitHostedProxyConfiguration through the Gateway configuration builder with only non-HTTP endpoints registered, or with no endpoint argument passed at all (both httpsEndpoint and httpEndpoint null).","commonSituations":"Registering the gateway resource with only tcp/custom-scheme endpoints; forgetting to call WithHttpEndpoint/WithHttpsEndpoint on the gateway resource before emitting configuration; passing the wrong resource into the builder.","solutions":["Add an HTTPS endpoint to the gateway resource: .WithHttpsEndpoint(port: ...).","Or add an HTTP endpoint: .WithHttpEndpoint(port: ...) if TLS termination happens elsewhere.","Verify the fluent chain registers the endpoint before the gateway configuration expression is built.","Inspect EmitProxyConfiguration call sites to confirm the correct resource with endpoints is passed in."],"exampleFix":"// before\nvar gateway = builder.AddContainer(\"gateway\", \"yarp\");\ngateway.WithGatewayConfiguration(...); // no HTTP(S) endpoint\n\n// after\nvar gateway = builder.AddContainer(\"gateway\", \"yarp\")\n    .WithHttpEndpoint(targetPort: 8080);\ngateway.WithGatewayConfiguration(...);","handlingStrategy":"validation","validationCode":"// Confirm the gateway resource has an http/https endpoint before building config\nvar gateway = builder.AddContainer(\"gateway\", \"yarp\").WithHttpEndpoint(targetPort: 8080);","typeGuard":null,"tryCatchPattern":"try { gateway.WithGatewayConfiguration(...); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"At least one gateway endpoint\"))\n{ logger.LogError(ex, \"Gateway needs an http/https endpoint\"); throw; }","preventionTips":["Register the gateway's HTTP(S) endpoint before any configuration emission.","Use WithHttpsEndpoint when TLS terminates at the gateway.","Double-check which resource instance the builder receives."],"tags":["blazor","yarp","gateway","endpoints","configuration"],"backgroundTag":"missing-required-config-field","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}