Open ctaggart opened 3 years ago
Calling CreateDatabase with an empty account is not supported.
On linux I'm getting:
Error: AzureHttpError(ExecuteRequestError(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain(".documents.azure.com")), port: None, path: "/dbs", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Custom { kind: Other, error: "failed to lookup address information: Name or service not known" })) }))
That's because the cosmosdb account is an element of the constructed URI.
In your case the constructed URI would be: https://.documents.azure.com/dbs
which is clearly invalid.
My question is, should we return an error during client construction if the caller passes an empty string (like you did)? Right now the CosmosClient
constructor if infallible.
Sorry I didn't address your issue (got sidetracked by the aforementioned problem) 🤦 ...
About the offer, notice that that field is not mandatory. The example you are using valorizes it:
let create_collection_response = db_client
.create_collection("/id")
.indexing_policy(ip)
.offer(Offer::Throughput(400)) // <-- this is optional
.execute("panzadoro")
.await?;
In order to use CosmosDB serverless you must not specify it.
It's not compile-time checked because right now there is no CosmosServelessClient
. We could add it in the future and make sure the offer option is not settable.
I get this error when trying to use a Cosmos Serverless cluster.
Steps to reproduce: