3

Am a new starter to Astra Datastax, Apache Cassandra database. We have created a simple asp.net core API to consume the database from Astra DataStax using a secure connect bundle(Zip file with certs and other information). It is working in the local as expected, however, when publishing to azure app service it is not working, but throw's the below error.

An unhandled exception was thrown by the application. Exception: System.AggregateException: One or more errors occurred. (There was an error fetching the metadata information from the Cloud Metadata Service (https://yourdb.db.astra.datastax.com:31977/metadata). Please make sure your cluster is not parked or terminated. See inner exception for more details.) ---> Cassandra.NoHostAvailableException: There was an error fetching the metadata information from the Cloud Metadata Service

we have checked the DB which is working(Not parked or terminated) and no issues when connecting from local.

Here is the code we are using to connect to the DB to establish a session.

 private async Task<ISession> ConnectToAstra(string username, string password, string keyspace, string secureConnectBundlePath)
    {
        var session = await Cluster.Builder()
                   .WithCloudSecureConnectionBundle(secureConnectBundlePath)
                   .WithCredentials(username, password)
                   .WithQueryOptions(new QueryOptions().SetConsistencyLevel(ConsistencyLevel.LocalQuorum))
                   .Build()
                   .ConnectAsync(keyspace);

        return session;
    }

Note: We have validated the path of the bundle after publishing in Azure App service and also tried moving the Secure bundle to wwwroot folder as well, but no luck.

Any help/guidance will help us to move forward.

Cheers!!

Aaron
  • 55,518
  • 11
  • 116
  • 132
Venkatesh
  • 269
  • 1
  • 11

1 Answers1

0

The error you posted indicates that your app is not able to reach any of the Astra nodes so it couldn't get the cluster metadata such as schema and topology.

This is most likely a network connectivity issue with your app and your Astra instance. Note that VPC peering is only available on Classic Astra databases and it is not available for dev and test databases.

If you provide more info on what you mean by "no issues when connecting from local", it will give us additional insight and I'll be happy to update my answer. Cheers!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
  • Thanks for the quick reply. "no issues when connecting from local", here i refered, when running the asp.net core api in my local machine using the above code it is able to connect to the astra datastax database and fetched the results, we placed the secure-bundle.zip in the soultion filder. But after publishing the api to azure app service getting the above error. And there is no firewall associated to azure app service, in that azurr subscription there is no other resources as we are doing it for our internal testing purpose. – Venkatesh Mar 07 '21 at 16:05
  • If it works from your laptop then that points to a network connectivity issue. Make sure that there's a route from your Azure app to Astra. Cheers! – Erick Ramirez Mar 08 '21 at 03:00
  • I have a similar problem connecting to Astra Datastax from my school network. Has a solution been found? – Haim Apr 22 '22 at 01:24
  • @Haim the problem is with your school network as I've explained to you in https://community.datastax.com/questions/13772/. Cheers! – Erick Ramirez May 11 '22 at 04:24