{"record":{"id":"c3dac45eb461b02e","repo":"microsoft/aspire","slug":"generated-deno-dockerfiles-do-not-support-publishmethod-use","errorCode":null,"errorMessage":"Generated Deno Dockerfiles do not support {publishMethod}. Use AddJavaScriptApp(...).WithDeno() or provide a custom Dockerfile.","messagePattern":"Generated Deno Dockerfiles do not support (.+?)\\. Use AddJavaScriptApp\\(\\.\\.\\.\\)\\.WithDeno\\(\\) or provide a custom Dockerfile\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.JavaScript/DenoHostingExtensions.cs","lineNumber":954,"sourceCode":"            entrypoint.Add(\"--allow-net\");\n            entrypoint.Add(\"--allow-env\");\n            entrypoint.Add(\"--cached-only\");\n            entrypoint.Add(containerScriptPath);\n        }\n\n        NormalizeDenoContainerPathArguments(entrypoint);\n        return [.. entrypoint];\n    }\n\n    private static void ThrowIfUnsupportedDenoDockerfileOptions(IResource resource)\n    {\n        if (resource.TryGetLastAnnotation<JavaScriptPublishModeAnnotation>(out var publishMode) &&\n            publishMode.Mode is JavaScriptPublishMode.StaticWebsite or JavaScriptPublishMode.NodeServer)\n        {\n            var publishMethod = publishMode.Mode == JavaScriptPublishMode.StaticWebsite\n                ? nameof(PublishAsStaticWebsite)\n                : nameof(PublishAsNodeServer);\n            throw new InvalidOperationException($\"Generated Deno Dockerfiles do not support {publishMethod}. Use AddJavaScriptApp(...).WithDeno() or provide a custom Dockerfile.\");\n        }\n\n        if (resource.TryGetLastAnnotation<JavaScriptPackageManagerAnnotation>(out var packageManager) &&\n            !string.Equals(packageManager.ExecutableName, \"deno\", StringComparison.Ordinal))\n        {\n            throw new InvalidOperationException($\"Generated Deno Dockerfiles do not support alternate package manager '{packageManager.ExecutableName}'. Use WithDeno() or provide a custom Dockerfile.\");\n        }\n\n        if (resource.TryGetLastAnnotation<DenoCommandLineAnnotation>(out var deno) &&\n            deno.NodeModulesDirSet &&\n            deno.NodeModulesDirMode == DenoNodeModulesDirMode.Manual)\n        {\n            throw new InvalidOperationException(\"The 'manual' node_modules mode is not supported by generated Deno Dockerfiles because node_modules is excluded from the build context. Use the 'auto' mode or provide a custom Dockerfile.\");\n        }\n\n        if (deno is not null)\n        {\n            if (deno.RuntimeArgs.Any(argument =>","sourceCodeStart":936,"sourceCodeEnd":972,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.JavaScript/DenoHostingExtensions.cs#L936-L972","documentation":"Aspire's auto-generated Deno Dockerfiles only support running a Deno app directly; they cannot serve a static website or a Node-style server build output. When the resource carries a JavaScriptPublishModeAnnotation of StaticWebsite or NodeServer, the library throws to stop an image that would not work. You must instead configure the resource via AddJavaScriptApp(...).WithDeno() or supply a custom Dockerfile.","triggerScenarios":"Calling PublishAsStaticWebsite() or PublishAsNodeServer() on a Deno-based JavaScript app resource, then publishing/generating its Dockerfile, so ThrowIfUnsupportedDenoDockerfileOptions (invoked from resourceBuilder) sees the incompatible JavaScriptPublishModeAnnotation.","commonSituations":"Copying a publish configuration from an npm/Node project onto a Deno app; a shared extension method that applies PublishAsStaticWebsite to every JavaScript resource; switching a resource's package manager to Deno after it was already set up as a static website.","solutions":["Remove the PublishAsStaticWebsite()/PublishAsNodeServer() call from the Deno resource.","Reconfigure the resource with AddJavaScriptApp(...).WithDeno() so the generated Dockerfile matches Deno semantics.","Provide a custom Dockerfile (e.g. WithDockerFile/WithDockerfileBuilder) that handles static website or Node-server output yourself."],"exampleFix":"// before\nvar deno = builder.AddJavaScriptApp(\"web\", \"main.ts\")\n    .PublishAsStaticWebsite();\n// after\nvar deno = builder.AddJavaScriptApp(\"web\", \"main.ts\")\n    .WithDeno();","handlingStrategy":"validation","validationCode":"// before publishing a Deno resource, verify no incompatible publish mode was set\nif (resource.TryGetLastAnnotation<JavaScriptPublishModeAnnotation>(out var mode) &&\n    mode.Mode is JavaScriptPublishMode.StaticWebsite or JavaScriptPublishMode.NodeServer)\n{\n    throw new InvalidOperationException(\"StaticWebsite/NodeServer publish modes are unsupported for generated Deno Dockerfiles.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    builder.AddJavaScriptApp(\"web\", \"main.ts\").WithDeno();\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Generated Deno Dockerfiles do not support\"))\n{\n    // remove PublishAsStaticWebsite/PublishAsNodeServer or switch to a custom Dockerfile\n}","preventionTips":["Do not apply PublishAsStaticWebsite/PublishAsNodeServer to resources whose package manager is Deno.","Call WithDeno() early so publish-mode validation happens against Deno semantics.","Keep publish configuration per-resource rather than in shared loops over JavaScript resources."],"tags":["deno","dockerfile","publish","configuration-conflict"],"backgroundTag":"conflicting-config-options","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"}