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

[BUG] Elsa.UseMongoDb() options.DatabaseName does not set Database #5391

Open
Nekrosis1 opened this issue May 16, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Nekrosis1
Copy link

Description

When registering MongoDB for ELSA, setting the options.DatabaseName does nothing.
Instead, ELSA relies on the "defaultauthdb", the database defined in the connection string after the /.
https://www.mongodb.com/docs/drivers/csharp/current/fundamentals/connection/connect/

Steps to Reproduce

  1. Detailed Steps:
  • Use Elsa with a mongoDB.
  • removing the defaultauthdb piece results in ELSA unable to connect to the db.
  • Setting a Database when registering the service does not change anything.
  1. Code Snippets:
builder.Services.AddElsa(elsa =>
{
   elsa.UseMongoDb(MongoDB.ConnectionString, options =>
   {
     options.DatabaseName = "myDatabase";
   });
 }

Expected Behavior

The Database set in the service registration gets used by ELSA

Actual Behavior

The Database set in the connection string as default auth DB gets used by ELSA.
If none is set (piece is optional), Elsa fails on startup.

Environment

  • Elsa Package Version: 3.1.3
  • Operating System: Win10.
  • Storage: MongoDB

Log Output

In program.cs, on
app.UseWorkflowsApi();
System.ArgumentNullException: 'Value cannot be null. (Parameter 'databaseName')'

Troubleshooting Attempts

Setting the desired Database as the default auth DB is a workaround, as long as you do not use an auth DB that differs from the Elsa DB.

@Nekrosis1 Nekrosis1 added the bug Something isn't working label May 16, 2024
Copy link

glime-ai bot commented May 16, 2024

Based on the information provided, it seems that there is an issue with the way Elsa is handling MongoDB database names. The expected behavior is that Elsa should use the database name specified in the service registration options, but instead, it is using the database name specified in the connection string's defaultauthdb.

To resolve this issue, you can try the following steps:

  1. Ensure that the MongoDB connection string includes the desired database name after the /. For example:

    mongodb://username:password@host:port/myDatabase
    
  2. If you want to use a different database name than the one specified in the connection string, you may need to look for an update or a patch from the Elsa team that addresses this issue.

  3. As a temporary workaround, you can set the desired database as the defaultauthdb in the connection string, as long as you do not need to use a different authentication database.

  4. Check the Elsa documentation and GitHub issues for any updates or discussions related to this problem. It's possible that other users have encountered this issue and that there might be a solution or a planned fix.

  5. If the issue persists and is not addressed in the documentation or by the community, consider opening a new issue on the Elsa GitHub repository to report this behavior and seek assistance from the developers.

Remember to provide all relevant information, including the version of Elsa you are using, the environment details, and the exact steps to reproduce the issue, to help the developers understand and address the problem effectively.

This comment was generated by Glime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant