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

AddDatabase doesn't add any database #6949

Open
jektvik opened this issue Dec 16, 2024 · 3 comments
Open

AddDatabase doesn't add any database #6949

jektvik opened this issue Dec 16, 2024 · 3 comments
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication untriaged New issue has not been triaged

Comments

@jektvik
Copy link

jektvik commented Dec 16, 2024

I was wondering why the AddDatabase function isn't creating any databases (as the xml comment says it should)

Is this a forgotten implementation ? The below variable isn't used.

cosmosSqlDatabases.Add(cosmosSqlDatabase);

@jektvik jektvik changed the title Why this noop ? AddDatabase doesn't add any database Dec 16, 2024
@joperezr joperezr added untriaged New issue has not been triaged area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication labels Dec 17, 2024
@aaronpowell
Copy link
Contributor

What's the Bicep (or resource in Azure) that you are seeing when deploying with Cosmos that has a configured database?

Looking through the code, the cosmosSqlDatabases collection is not actually needed (it's probably just there for debugging), as it's actually important that it's added to the AzureResourceInfrastructure instance, which it does on the line above:

infrastructure.Add(cosmosSqlDatabase);

This results in the CosmosDBSqlDatabase Azure SDK resource being included in the Bicep generation. See this test as an example of the Bicep to be generated:

public async Task AddAzureCosmosDBViaRunMode()

@jektvik
Copy link
Author

jektvik commented Dec 19, 2024

Hi Aaaron -> I don't do deployment just local dev (for now anyway) so I can't help with what bicep will look like as i haven't gotten to that part yet. So my only observation is that the cosmos container appears as expected but it doesn't get any databases inside.

@aaronpowell
Copy link
Contributor

Ah right. From looking into the codebase it looks like there's no special provisions for when using the emulator to pre-provision the databased. It might be possible with the CosmosDB SDK, but then the hosting integration would need to take a dependency on the SDK (which it doesn't currently) so it's probably not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

3 participants