Azure / azure-cosmos-db-emulator-docker

This repo serves as hub for managing issues, gathering feedback, and having discussions regarding the Cosmos DB Emulator Docker.
https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=docker-linux%2Ccsharp&pivots=api-nosql
MIT License
155 stars 47 forks source link

CreateIfNotExists failing after latest version 2.14.20.0 #106

Closed shreyanshchordia closed 1 month ago

shreyanshchordia commented 1 month ago

Describe the bug Our end to end tests have started failing with the latest image of cosmosdb docker emulator. Example error that we are seeing:

Message: {"Errors":["Resource with specified id, name, or unique index already exists."]}

The above error is thrown from containers.createIfNotExists function. We see this error even on empty fresh set up databases.

To Reproduce Steps to reproduce the behavior:

  1. Pull the latest image of the emulator
  2. Start a container with the image and setup the databases.
  3. Run containers.createIfNotExists function to create your containers in the database.

Expected behavior End to end tests must pass. containers.createIfNotExists function should not throw an error if the container exists. Screenshots image

Desktop (please complete the following information):

Docker Images Used:

**Arguments && Environment variables to start Docker: docker run -d --publish 8081:8081 \ --publish 10250-10255:10250-10255 \ --interactive \ --tty \ --name e2e-emulator \ --env AZURE_COSMOS_EMULATOR_PARTITION_COUNT=32 \ mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest

Docker Environment

niteshvijay1995 commented 1 month ago

@shreyanshchordia We are investigating the issue with latest version. In the meantime you can pull the stable version of emulator from mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:stable

aanaji commented 1 month ago

Thanks @niteshvijay1995. This worked for me too!!

@sajeetharan, I can't find the Cosmos DB emulator in the Microsoft Artifact Registry. Could someone from Microsoft start publishing the Cosmos DB emulator details there?

https://mcr.microsoft.com/en-us/

sajeetharan commented 1 month ago

@aanaji yes it has been feedback from many customers, however we have not prioritized this ask for the moment. We will be working on this soon and keep you posted!

davidwalschots commented 1 month ago

@aanaji One can run the following commands to get the information, even when not listed in the portal:

To list all the images found in the catalog:

curl -X GET https://mcr.microsoft.com/v2/_catalog

To list all the image versions of cosmosdb/linux/azure-cosmos-emulator:

curl -X GET https://mcr.microsoft.com/v2/cosmosdb/linux/azure-cosmos-emulator/tags/list

For us, using stable did not make a difference. We reverted back to 2.14.18-e2d1bbf7.

niteshvijay1995 commented 1 month ago

This issue is fixed in the latest version of emulator. Version - 2.14.20.0 (dd7750b6) - Available on latest tag