You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cosmosdb: CosmosDBNoSQLEndpointContainer doesn't work with vnext-preview emulator image #1024
The CosmosDBNoSQLEndpointContainer was built for the standard Cosmos DB emulator image (latest tag). It does not work with the vnext-preview image (mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview), which is the newer Linux-native emulator
Both images serve the same NoSQL API, but vnext has different runtime behavior that breaks assumptions in the current module.
What breaks
vnext defaults to HTTP — the standard image defaults to HTTPS, which is what url and _wait_until_ready hardcode. vnext needs --protocol https passed as a command to opt into HTTPS. There is no way to configure this through the module.
No Data Explorer on vnext — _wait_until_ready() polls https://localhost:8081/_explorer/index.html as a readiness signal. vnext returns 400 on that path, so the check loops for 120s and times out.
No PEM certificate on vnext — start() calls _download_cert() looking for a file at the legacy Windows-style path inside the container. vnext does not write a cert there, so this raises docker.errors.NotFound.
503s during startup are not retried — After the container is up, vnext returns CosmosHttpResponseError (503, "pgcosmos extension is still starting") for a few seconds before it can serve queries. _wait_for_query_success only catches ServiceRequestError (connection-level errors), so it does not retry on 503.
I wrote a subclass that overrides start(), _wait_until_ready(), and _wait_for_query_success() — it passes --protocol https as a command, skips the cert download and explorer check, and catches 503s during readiness polling. It works but depends on the internal class hierarchy, which makes it fragile.
Suggestion
Some ideas:
Add a protocol parameter (http/https) to control the URL scheme and pass the right startup command for vnext.
Make _wait_until_ready() skip the explorer URL check when it returns 400 or is not available. Relying on _wait_for_query_success alone is sufficient.
Make _download_cert() optional or catch NotFound gracefully — for vnext there is no cert to download.
Add CosmosHttpResponseError to the retry decorator in _wait_for_query_success.
Alternatively, a dedicated vnext-aware container class would keep things clean.
An explicit emulator mode may be safer than inferring all behavior from the image tag. That mode could control protocol, startup arguments, readiness checks, and certificate handling. Tests for both the standard and vnext-preview images should include custom ports and delayed readiness.
Activity
hiSandog commentedon Jul 11, 2026
An explicit emulator mode may be safer than inferring all behavior from the image tag. That mode could control protocol, startup arguments, readiness checks, and certificate handling. Tests for both the standard and
vnext-previewimages should include custom ports and delayed readiness.