{"record":{"id":"39181747815e9ff9","repo":"microsoft/aspire","slug":"resource-parentresource-name-does-not-have-an-http-or-https-391817","errorCode":null,"errorMessage":"Resource '{parentResource.Name}' does not have an HTTP or HTTPS endpoint. Browser debugging requires an endpoint to navigate to.","messagePattern":"Resource '(.+?)' does not have an HTTP or HTTPS endpoint\\. Browser debugging requires an endpoint to navigate to\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs","lineNumber":2963,"sourceCode":"\n        builder.ApplicationBuilder.AddResource(debuggerResource)\n            .WithParentRelationship(parentResource)\n            .WaitFor(builder)\n            .ExcludeFromManifest()\n            .WithDebugSupport(\n                mode =>\n                {\n                    // Resolve endpoint at run time so dynamically added endpoints are reflected\n                    EndpointAnnotation? endpointAnnotation = null;\n                    if (parentResource.TryGetAnnotationsOfType<EndpointAnnotation>(out var endpoints))\n                    {\n                        endpointAnnotation = endpoints.FirstOrDefault(e => e.UriScheme == \"https\")\n                            ?? endpoints.FirstOrDefault(e => e.UriScheme == \"http\");\n                    }\n\n                    if (endpointAnnotation is null)\n                    {\n                        throw new InvalidOperationException(\n                            $\"Resource '{parentResource.Name}' does not have an HTTP or HTTPS endpoint. Browser debugging requires an endpoint to navigate to.\");\n                    }\n\n                    var endpointReference = parentResource.GetEndpoint(endpointAnnotation.Name);\n\n                    return new BrowserLaunchConfiguration\n                    {\n                        Mode = mode,\n                        Url = endpointReference.Url,\n                        WebRoot = parentResource.WorkingDirectory,\n                        Browser = browser\n                    };\n                },\n                BrowserCapability);\n\n        return builder;\n    }\n","sourceCodeStart":2945,"sourceCodeEnd":2981,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs#L2945-L2981","documentation":"WithBrowserDebugger() requires the JavaScript resource to expose an HTTP or HTTPS endpoint so the browser can be pointed at a running URL. The library scans the resource's endpoint annotations for an https endpoint (falling back to http); if neither exists it cannot construct a launch URL and throws this InvalidOperationException at model-build time.","triggerScenarios":"Calling WithBrowserDebugger() on a JavaScript/Node resource that has no WithEndpoint/WithHttpEndpoint/WithHttpsEndpoint and no default endpoints (e.g. a plain AddNpmApp/AddViteApp without WithEndpoint, or a resource whose endpoints were removed).","commonSituations":"Developers add browser debugging to a worker/API-only Node app, forget to add an endpoint annotation, or reference a parent resource whose endpoints are defined on a child/reference target.","solutions":["Add an HTTP or HTTPS endpoint to the resource, e.g. .WithEndpoint(scheme: \"http\", targetPort: 3000) or .WithHttpEndpoint(port: 3000) before WithBrowserDebugger().","Verify the endpoint is on the same resource you call WithBrowserDebugger() on (parentResource), not on a dependency.","Check the endpoints list isn't filtered; the code picks https first, then http — either scheme satisfies it."],"exampleFix":"// before\nvar app = builder.AddNpmApp(\"frontend\", \"./frontend\")\n    .WithBrowserDebugger();\n// after\nvar app = builder.AddNpmApp(\"frontend\", \"./frontend\")\n    .WithHttpEndpoint(port: 3000)\n    .WithBrowserDebugger();","handlingStrategy":"validation","validationCode":"var hasEndpoint = app.Resource.Annotations.OfType<EndpointAnnotation>().Any(e => e.UriScheme is \"http\" or \"https\");\nif (!hasEndpoint) throw new InvalidOperationException(\"Add an http/https endpoint before WithBrowserDebugger().\");","typeGuard":null,"tryCatchPattern":"try { app.WithBrowserDebugger(); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"HTTP or HTTPS endpoint\")) { /* add endpoint or disable browser debugging */ }","preventionTips":["Always pair WithBrowserDebugger() with WithHttpEndpoint/WithHttpsEndpoint on the same resource.","Check endpoint annotations exist in resource annotation list when composing custom builders.","Review the Aspire JavaScript samples for the minimal endpoint setup."],"tags":["javascript","endpoint","browser-debugging"],"backgroundTag":"resource-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}