Error Handling

Troubleshoot Connectivity to the API Endpoint

To resolve connectivity issues to the SingleStore Kai ("the API") endpoint, perform the following steps. Move on to the next step only if the current step is working or the associated issue is resolved.

  1. Get the Connection String: On the Cloud Portal, select Deployments > Overview > your_workspace > Connect. If the API is enabled for your workspace, the connection string is visible under the MongoDB Client tab. The connection string is in mongodb://<user>:<password>@<hostname>:<port>/<connection_parameter=value&...> format. Here's a sample connection string:

    mongodb://<user>:<password>@svc-XXX-mongo.YYY.svc.singlestore.com:27017/?authMechanism=PLAIN&tls=true&loadBalanced=true

    If the connection string is not present, ensure that the API endpoint is enabled for your workspace. You may need to create a new workspace and enable the API for this workspace.

  2. Ensure that the API endpoint's DNS can be resolved: Copy the hostname of your API endpoint and run the following command to ensure that the client can access the service:

    nslookup svc-XXX-mongo.YYY.svc.singlestore.com
    Non-authoritative answer:
    Name: svc-XXX-mongo.YYY.svc.singlestore.com
    Address: xx.xxx.xxx.xx
    Name: svc-XXX-mongo.YYY-mongo.aws-virginia-6.svc.singlestore.com
    Address: xx.xx.xxx.xx

    If this command returns an error, the client is unable to find (or resolve) the DNS of the API endpoint. Run this command from a different machine on a different network (for example, an EC2 instance). If the command works on other machines, then the issue is specific to the initial (original) client machine's environment.

  3. Establish a TCP connection: Create a TCP connection to the API using the following command:

    telnet svc-XXX-mongo.YYY.svc.singlestore.com 27017
    Trying xx.xxx.xxx.xx...
    Connected to svc-XXX-mongo.YYY.svc.singlestore.com.
    Escape character is '^]'.

    If the connection is accepted, the output is similar to the one displayed above. If the output is different, a firewall rule may be blocking the connection. Run this command from a different machine on a different network (for example, from an EC2 instance). If the command works on other machines, then the issue is specific to the initial (original) client machine's environment.

  4. Establish a TLS connection, and perform initial handshake: Use the openssl s_client to establish a TLS connection to the API endpoint and send a handshake message. Run the following command with the hostname of the API endpoint:

    (echo -e "\x24\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xdd\x07\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\x08\x69\x73\x6d\x61\x73\x74\x65\x72\x00\x00" ; cat) | openssl s_client -connect svc-XXX-mongo.YYY.svc.singlestore.com:27017
    read R BLOCK...
    ??ismastermsg...

    If the output is different from the one displayed above, the machine is unable to create a TLS connection to the API endpoint. Run this command from a different machine on a different network (for example, from an EC2 instance). If the command works on other machines, then the issue is specific to the initial (original) client machine's environment. You may need to install a root certificate, if shown in the certificate chain output from openssl.

  5. Connect to the API endpoint without authentication: Remove the <user>, <password>, and authMechanism parameter from the connection string, and ping the API endpoint, using mongosh (MongoDB® Shell) as follows:

    mongosh --eval "db.runCommand({ping:1})" "mongodb://svc-XXX-mongo.YYY.svc.singlestore.com:27017/?tls=true&loadBalanced=true"
    Current Mongosh Log ID: 64586253e71f86ba3f7fa0c1
    ...
    ------
    The server generated these startup warnings when booting
    2023-05-08T02:45:42Z: Welcome to SingleStore with MongoDB compatibility!
    2023-05-08T02:45:42Z: https://www.singlestore.com
    ------
    { ok: 1 }
    ...

    If the output does not contain a welcome message from SingleStore and an ok message, the machine is unable to ping the API endpoint. Run this command from a different host machine on a different network (for example, from an EC2 instance). If the command works on other machines, then the issue is specific to the initial (original) client machine's environment.

  6. Connect to the API endpoint with authentication: Connect to the API endpoint using a known simple client, such as mongosh (MongoDB® Shell) using the original connection string copied from the Cloud Portal. Replace the placeholders in the connection string with the username and password. Additionally, you can execute a simple SQL command, such as SHOW DATABASES. Here's an example:

    mongosh --eval "show databases" "mongodb://admin:pa55w0rd@svc-XXX-mongo.YYY.svc.singlestore.com:27017/?authMechanism=PLAIN&tls=true&loadBalanced=true"
    Current Mongosh Log ID: 64586253e71f86ba3f7fa0c1
    ...
    ------
    The server generated these startup warnings when booting
    2023-05-08T02:45:42Z: Welcome to SingleStore with MongoDB compatibility!
    2023-05-08T02:45:42Z: https://www.singlestore.com
    ------
    information_schema 0.00 B
    dbTest 0.00 B

    The output contains a welcome message from SingleStore and a list of databases attached to the workspace.

  7. Connect to the API endpoint from the original client: If all the previous steps have been successfully completed, try connecting to the API endpoint with the original client (the client application that you faced connectivity issues with, before starting the troubleshooting process). If possible, try connecting from the same machine on which you were able to successfully connect using mongosh.

If you are still facing connectivity issues, contact SingleStore Support.

Troubleshoot Specific Errors

MongoNetworkError: getaddrinfo ENOTFOUND svc-XXX-mongo.YYY.svc.singlestore.com

Issue: The client is unable to resolve the DNS for the API endpoint. 

Solution: Ensure that you are using the correct connection string as shown in the Cloud Portal.

MongoNetworkError: Client network socket disconnected before secure TLS connection was established

Issue: The client is not allowed through the firewall rules for the workspace.

Solution: Update the firewall rules to allow access to the client.

MongoNetworkError: ...ssl3_get_record:wrong version number:...

Issue: The client tried to connect to the DDL or DML endpoint.

Solution: Ensure that you are using the correct connection string as shown in the Cloud Portal.

MongoServerError: Authentication failed

Issue: Incorrect username or password.

Solution: Use the correct username or password in the connection string.

Last modified: November 26, 2024

Was this article helpful?