Why am I receiving this error?

So, you are installing gcc using homebrew but according to @bigminiboss that doens’t seem doable, so I’d suggest using another method.

@bigminiboss I’ve never used Docker with Replit, it’s better for this scenario?

2 Likes

yeah i’m i’m also trying to install mongodb atlas cli, but same problem happens

1 Like

oh docker, that might be possible I also never used docker with replit might ask @9pfs but homebrew normally is using sudo to install (at least per website instructions). sorry I didn’t fully read thread is there a reason he needs to have a c++ variant for his discord.py bot XD

2 Likes

It looks like he’s trying an already build bot that uses mongodb atlas as a database.

Since he said his objective is to tweak the bot as he moves forwards I believe that’s a pre-requirement to this specific bot start working.

But I’m out of ideas haha

1 Like

Ensure that special characters within both the MongoDB URI and the database credentials are meticulously encoded, particularly if they encompass non-ASCII characters. Additionally, it is imperative to verify the accuracy of the database credentials, confirming that they possess the requisite permissions for accessing the specified database. Furthermore, meticulously scrutinize the MongoDB connection string, assuring its precise format devoid of any unanticipated characters or spaces, and confirm its adherence to correct URL encoding practices.

EDIT: You can also use debugging tools or print statements to try and diagnose the issue.

same I kinda hit these kinds of roadblocks sometimes too XD (for example, repl identity)

1 Like

okay so, due to @ in my password i will need to change the encode. How do i import the library EncodeURIComponent for my py project?

1 Like

okay i tried making the encode, i don’t know why i received ssl thing:

ERROR    discord.app_commands.tree Ignoring exception in command 'create'
Traceback (most recent call last):
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/runner/RP-Utilities-Beta/RP-Utilities-Beta/cogs/CharactersCog.py", line 132, in _character_default_create_slash
    response = "Error, the character with this prompt already exist." if await self.client.database.register_default_character(user_id=user, name=name, prompt_prefix=prompt, image=url) else "Character created."
  File "/home/runner/RP-Utilities-Beta/RP-Utilities-Beta/rpu_database.py", line 214, in register_default_character
    database = await self.db['characters'].find_one({'user_id': user_id})
  File "/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/collection.py", line 1508, in find_one
    for result in cursor.limit(-1):
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/cursor.py", line 1262, in next
    if len(self.__data) or self._refresh():
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/cursor.py", line 1153, in _refresh
    self.__session = self.__collection.database.client._ensure_session()
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1868, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1811, in __start_session
    self._topology._check_implicit_session_support()
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/topology.py", line 583, in _check_implicit_session_support
    self._check_session_support()
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/topology.py", line 599, in _check_session_support
    self._select_servers_loop(
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/topology.py", line 269, in _select_servers_loop
    raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: ac-yggga1g-shard-00-00.bscpl0p.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007),SSL handshake failed: ac-yggga1g-shard-00-01.bscpl0p.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007),SSL handshake failed: ac-yggga1g-shard-00-02.bscpl0p.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007), Timeout: 30s, Topology Description: <TopologyDescription id: 64fcfbee2799d787a432f14e, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-yggga1g-shard-00-00.bscpl0p.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('SSL handshake failed: ac-yggga1g-shard-00-00.bscpl0p.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007)')>, <ServerDescription ('ac-yggga1g-shard-00-01.bscpl0p.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('SSL handshake failed: ac-yggga1g-shard-00-01.bscpl0p.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007)')>, <ServerDescription ('ac-yggga1g-shard-00-02.bscpl0p.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('SSL handshake failed: ac-yggga1g-shard-00-02.bscpl0p.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007)')>]>

Ensure that your MongoDB connection string is correctly configured. Make sure it includes the correct hostname or IP address, port number, and any required authentication credentials.

username = parse.quote_plus(os.environ['db_username'])
password = parse.quote_plus(os.environ['db_password'])
db_name = "rpucloudserver"
connection_uri = f"mongodb+srv://{username}:{password}@{db_name}.bscpl0p.mongodb.net/?retryWrites=true&w=majority"
it seems correctly configured, according to the website


Now the port number, Ip ands tuff i don’t know

Try encoding the URL using this code:

import urllib.parse

username = "your_username_here"
password = "your_password_here"
db_name = "your_db_name_here"
url_template = f"{password}@{db_name}.bscpl0p.mongodb.net/?retryWrites=true&w=majority"

encoded_url = urllib.parse.quote(url_template, safe='')
print(encoded_url)

this time the bot runned, but i still got error

ERROR    discord.ext.commands.bot Ignoring exception in command character search
Traceback (most recent call last):
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/runner/RP-Utilities-Beta/RP-Utilities-Beta/cogs/CharactersCog.py", line 40, in _character_search
    search_result = await ctx.bot.database.search_default_character(user_id=user)
  File "/home/runner/RP-Utilities-Beta/RP-Utilities-Beta/rpu_database.py", line 184, in search_default_character
    database = await self.db['characters'].find_one({'user_id': user_id})
  File "/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/collection.py", line 1508, in find_one
    for result in cursor.limit(-1):
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/cursor.py", line 1262, in next
    if len(self.__data) or self._refresh():
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/cursor.py", line 1153, in _refresh
    self.__session = self.__collection.database.client._ensure_session()
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1868, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1811, in __start_session
    self._topology._check_implicit_session_support()
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/topology.py", line 583, in _check_implicit_session_support
    self._check_session_support()
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/topology.py", line 599, in _check_session_support
    self._select_servers_loop(
  File "/home/runner/RP-Utilities-Beta/.pythonlibs/lib/python3.10/site-packages/pymongo/topology.py", line 269, in _select_servers_loop
    raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: encoding with 'idna' codec failed (UnicodeError: label empty or too long), Timeout: 30s, Topology Description: <TopologyDescription id: 64fdfbb25cd07d1dc04dbde1, topology_type: Unknown, servers: [<ServerDescription ('mongodb%2bsrv%3a%2f%2fhirukarogue%3adv%40plasma123%40rpucloudserver.bscpl0p.mongodb.net%2f%3fretrywrites%3dtrue%26w%3dmajority', 27017) server_type: Unknown, rtt: None, error=UnicodeError("encoding with 'idna' codec failed (UnicodeError: label empty or too long)")>]>
1 Like

that when i tested database related commands

1 Like

and this is the print result
mongodb%2Bsrv%3A%2F%2F(Username_encoded)%3A(Password_encoded)%40rpucloudserver.bscpl0p.mongodb.net%2F%3FretryWrites%3Dtrue%26w%3Dmajority

1 Like

If you are using an SRV DNS record in your connection string (as indicated by the mongodb%2bsrv%3a%2f%2f part in the error message), make sure it is set up correctly and resolves to the correct MongoDB server.

setup correcly?

    username = os.environ['db_username']
    password = os.environ['db_password']
    db_name = "rpucloudserver"
    url_template = f"mongodb+srv://{username}:{password}@{db_name}.bscpl0p.mongodb.net/?retryWrites=true&w=majority"

    encoded_url = parse.quote(url_template, safe='')
    # print(encoded_url)
    # await self.database.connect(connection_uri)
    await self.database.connect(encoded_url)

how do i check if it resolves to the correct MongoDB server?

1 Like

The formatting of your connection string appears to be accurate. The only potential issue that comes to mind is whether the credentials you have provided are indeed correct.

you mean my username and password?

1 Like

Yes, I mean your username and password it may also be your DB name.

the problem of my password is that i can’t reveal it, unless i create one that is completely random, which i don’t know. I don’t want to reveal my password

1 Like