Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection String Breaks Between Executions Due to .WithDataVolume() #3669

Closed
rodrigosol opened this issue Apr 12, 2024 · 8 comments
Closed
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Comments

@rodrigosol
Copy link

I am attaching a volume to PostgreSQL using the following code snippet:

var postgres = builder.AddPostgres("database")
                      .WithPgAdmin()
                      .WithDataVolume();

However, my service is unable to connect to the database, resulting in the following error:

Unhandled exception. Npgsql.PostgresException (0x80004005): 28P01: password authentication failed for user "postgres"

The connection succeeds when I remove the .WithDataVolume(); line. It appears that the password used in the connection string is being generated anew with each execution, instead of using the password that was generated when the database was initially created.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Apr 12, 2024
@davidfowl
Copy link
Member

Yes, this is a known issue when using volumes #1151

cc @eerhardt

@rodrigosol
Copy link
Author

@davidfowl Sorry! I searched here before opening, but I did not find it. Thanks.

@davidfowl
Copy link
Member

The workaround is to specify a password as a parameter

@rodrigosol
Copy link
Author

@davidfowl, can you point out some examples or documentation that shows how to set the password?

Probably it is obvious, but I am new to the .NET world and am on the learning curve getting used to Microsoft documentation.

I really appreciate your help! Thanks

@davidfowl
Copy link
Member

Wrote something here:

dotnet/docs-aspire#672 (comment)

@davidfowl davidfowl reopened this Apr 16, 2024
@davidfowl
Copy link
Member

We should document this as a known issue.

@acfuns
Copy link

acfuns commented Jul 23, 2024

Good job, .WithDataVolume() can pass the database account password validation properly now.

@davidfowl
Copy link
Member

This was fixed in 8.1

@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

No branches or pull requests

3 participants