-
Notifications
You must be signed in to change notification settings - Fork 701
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
We have a fairly simple Nodejs app spun up alongside SQL Server, Redis, Azure Storage and a .NET API. This works locally (across Windows, Linux and OSX developers), however does not work in GitHub Codespaces.
Our Redis cache is called "project-cache", which in turn tries to set the environment variable ConnectionStrings__project-cache
. I've also set 2 manual environment variables to confirm the root cause:
Of the 3, only ConnectionStrings__project_cache_test
is set.
On Codespaces using the default environment, it seems that DCP is not sending the Environment Variables correctly which causes this to be dropped. As it's a black box I'm unable to see exactly where or why this would happen. It seems the use of env
may be required depending on the shell, but I don't understand why the NodeJs acts differently from the .NET project.
The only solution currently is to remove the hyphen from the resource name within the AppHost.
I know that this is a "Codespaces thing" but it seems that Environment Variables should be reliably set across all platforms / shells, which I'm assuming means that DCP isn't quoting them / using env
specifically in the NodeJS application type, as these Environment Variables are correctly passed to the .NET application.
Expected Behavior
Environment variables with hyphens in the name are set correctly in a NodeJs app.
Steps To Reproduce
Add an Npm app to the AppHost with an environment variable containing a dash.
builder.AddNpmApp("anything", "path/to/anything", "dev")
.WithEnvironment("Something-Has-A-Hypen", "Anything");
Run Aspire within Github Codespaces, note that the environment variable is not set.
Exceptions (if any)
No response
.NET Version info
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.100/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
8.0.403 [/usr/share/dotnet/sdk]
9.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/share/dotnet]
global.json file:
Not found
Anything else?
Seems to be a DCP issue. This is running through VS Code with the C# Dev Kit installed on GitHub Codespaces.