vercel / cosmosdb-server

A Cosmos DB server implementation for testing your applications locally.
MIT License
174 stars 30 forks source link

read-meta hardcoded to port 3000 #55

Closed lossyrob closed 3 years ago

lossyrob commented 3 years ago

The read-meta handler hardcodes port 3000, which is incorrect when running the server on another port. This causes the Python client to throw a connection refused exception after connecting to a server on another port:

from azure.cosmos import CosmosClient
cosmos = CosmosClient("https://localhost:32797", credential="fake")
 list(cosmos.list_databases())

This throws the exception:

 <urllib3.connection.HTTPSConnection object at 0x7fd48863dfd0>: Failed to establish a new connection: [Errno 111] Connection refused

due to the client trying to communicate with port 3000, because of the hard coded values.

This can be solved by passing server options to handlers, so that the port can be dynamically generated; this would be a lot of code changes so perhaps there's an easier way to avoid this?

nkzawa commented 3 years ago

This should be fixed by https://github.com/vercel/cosmosdb-server/pull/58, released as 0.10.0. Thanks for your report!