CommunityToolkit / CommunityToolkit/Aspire
Redis WithDbGate fails to connect when Redis uses TLS
- Dominant language
- C#
- Stars
- 627
- Forks
- 196
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 35
Description
### Describe the bug
The Redis `WithDbGate()` extension configures DbGate with a manually constructed Redis URL but does not configure DbGate to trust Aspire’s development certificate.
Aspire Redis enables TLS by default. DbGate therefore cannot establish the configured Redis connection because its Node.js runtime does not trust the Aspire-generated certificate.
The manually constructed URL also duplicates logic already provided by `RedisResource.UriExpression`. That expression correctly handles credentials, deferred endpoint resolution, and the redis:// versus rediss:// scheme.
### Regression
Unknown. I have not confirmed a previous Aspire Community Toolkit version where the Redis DbGate integration worked with Aspire’s default TLS configuration.
### Steps to reproduce
```text
1. Create an Aspire AppHost with Redis and DbGate:
var builder = DistributedApplication.CreateBuilder(args);
builder.AddRedis("redis1")
.WithDbGate();
builder.Build().Run();
2. Start the AppHost.
3. Open DbGate from the Aspire dashboard.
4. Select the redis1 connection in the DbGate UI.
5. Attempt to connect to Redis.
6. Observe that DbGate cannot establish the connection.
```
### Expected behavior
Opening the redis1 connection in the DbGate UI should connect successfully and allow the user to browse and manage the Redis instance.
### Screenshots
_No response_
### IDE and version
Rider
### IDE version
2026.2
### Nuget packages
```text
CommunityToolkit.Aspire.Hosting.Redis.Extensions
```
### Additional context
The proposed fix is to use Aspire’s existing deferred Redis URI expression:
```
context.EnvironmentVariables[$"URL_{connectionId}"] =
redisResource.UriExpression;
```
DbGate should also receive Aspire’s certificate bundle:
```
dbGateBuilder.WithCertificateTrustConfiguration(context =>
{
context.EnvironmentVariables["NODE_EXTRA_CA_CERTS"] =
context.CertificateBundlePath;
return Task.CompletedTask;
});
```
A Docker-backed AppHost test can verify the complete behavior by authenticating with DbGate, refreshing the Redis connection, invoking Redis PING, and asserting that the response is PONG.
See https://github.com/0mar-rivero/Aspire/tree/fix/redis-dbgate-tls for a working fix. If that looks good I can open a PR.
### Help us help you
Yes, I'd like to be assigned to work on this item
Contributor guide
Research direction
Start at the Redis WithDbGate extension and compare its manually constructed URL with RedisResource.UriExpression, then inspect the DbGate certificate-trust configuration path. Add a Docker-backed AppHost test that authenticates with DbGate, refreshes the Redis connection, invokes Redis PING, and verifies a PONG response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, docker, node.js, redis
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100