Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-5146

[Build Failure] AWS ECS Could not find user

    • Type: Icon: Build Failure Build Failure
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.12
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Name of Failure:

      pymongo.errors.OperationFailure: Could not find user "arn:aws:iam::557821124784:user/authtest_fargate_user" for db "$external"

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_auth_aws_ubuntu_20_python3.13_aws_auth_test_4.4_5456f1ec045beaeee3a9b008b9522266fc9f43c1_25_02_19_20_22_28/logs?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      PYTHON-4975

      Stack trace:

       [2025/02/19 14:29:28.778] =================================== FAILURES ===================================
       [2025/02/19 14:29:28.778] _________________________ TestAuthAWS.test_connect_uri _________________________
       [2025/02/19 14:29:28.778] self = <test_auth_aws.TestAuthAWS testMethod=test_connect_uri>
       [2025/02/19 14:29:28.778]     def test_connect_uri(self):
       [2025/02/19 14:29:28.778]         with MongoClient(self.uri) as client:
       [2025/02/19 14:29:28.778] >           client.get_database().test.find_one()
       [2025/02/19 14:29:28.778] test/auth_aws/test_auth_aws.py:66:
       [2025/02/19 14:29:28.778] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       [2025/02/19 14:29:28.778] pymongo/synchronous/collection.py:1755: in find_one
       [2025/02/19 14:29:28.778]     for result in cursor.limit(-1):
       [2025/02/19 14:29:28.778] pymongo/synchronous/cursor.py:1284: in __next__
       [2025/02/19 14:29:28.778]     return self.next()
       [2025/02/19 14:29:28.778] pymongo/synchronous/cursor.py:1260: in next
       [2025/02/19 14:29:28.778]     if len(self._data) or self._refresh():
       [2025/02/19 14:29:28.778] pymongo/synchronous/cursor.py:1208: in _refresh
       [2025/02/19 14:29:28.778]     self._send_message(q)
       [2025/02/19 14:29:28.778] pymongo/synchronous/cursor.py:1102: in _send_message
       [2025/02/19 14:29:28.778]     response = client._run_operation(
       [2025/02/19 14:29:28.778] pymongo/_csot.py:119: in csot_wrapper
       [2025/02/19 14:29:28.778]     return func(self, *args, **kwargs)
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:1757: in _run_operation
       [2025/02/19 14:29:28.778]     return self._retryable_read(
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:1866: in _retryable_read
       [2025/02/19 14:29:28.778]     return self._retry_internal(
       [2025/02/19 14:29:28.778] pymongo/_csot.py:119: in csot_wrapper
       [2025/02/19 14:29:28.778]     return func(self, *args, **kwargs)
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:1822: in _retry_internal
       [2025/02/19 14:29:28.778]     return _ClientConnectionRetryable(
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:2568: in run
       [2025/02/19 14:29:28.778]     return self._read() if self._is_read else self._write()
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:2705: in _read
       [2025/02/19 14:29:28.778]     with self._client._conn_from_server(self._read_pref, self._server, self._session) as (
       [2025/02/19 14:29:28.778] /usr/lib/python3.9/contextlib.py:117: in __enter__
       [2025/02/19 14:29:28.778]     return next(self.gen)
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:1686: in _conn_from_server
       [2025/02/19 14:29:28.778]     with self._checkout(server, session) as conn:
       [2025/02/19 14:29:28.778] /usr/lib/python3.9/contextlib.py:117: in __enter__
       [2025/02/19 14:29:28.778]     return next(self.gen)
       [2025/02/19 14:29:28.778] pymongo/synchronous/mongo_client.py:1596: in _checkout
       [2025/02/19 14:29:28.778]     with server.checkout(handler=err_handler) as conn:
       [2025/02/19 14:29:28.778] /usr/lib/python3.9/contextlib.py:117: in __enter__
       [2025/02/19 14:29:28.778]     return next(self.gen)
       [2025/02/19 14:29:28.778] pymongo/synchronous/pool.py:1348: in checkout
       [2025/02/19 14:29:28.778]     conn = self._get_conn(checkout_started_time, handler=handler)
       [2025/02/19 14:29:28.778] pymongo/synchronous/pool.py:1510: in _get_conn
       [2025/02/19 14:29:28.778]     conn = self.connect(handler=handler)
       [2025/02/19 14:29:28.778] pymongo/synchronous/pool.py:1305: in connect
       [2025/02/19 14:29:28.778]     conn.authenticate()
       [2025/02/19 14:29:28.778] pymongo/synchronous/pool.py:648: in authenticate
       [2025/02/19 14:29:28.778]     auth.authenticate(creds, self, reauthenticate=reauthenticate)
       [2025/02/19 14:29:28.778] pymongo/synchronous/auth.py:450: in authenticate
       [2025/02/19 14:29:28.778]     auth_func(credentials, conn)
       [2025/02/19 14:29:28.778] pymongo/synchronous/auth_aws.py:86: in _authenticate_aws
       [2025/02/19 14:29:28.778]     res = conn.command("$external", cmd)
       [2025/02/19 14:29:28.778] pymongo/synchronous/helpers.py:47: in inner
       [2025/02/19 14:29:28.778]     return func(*args, **kwargs)
       [2025/02/19 14:29:28.778] pymongo/synchronous/pool.py:536: in command
       [2025/02/19 14:29:28.778]     return command(
       [2025/02/19 14:29:28.778] pymongo/synchronous/network.py:213: in command
       [2025/02/19 14:29:28.778]     helpers_shared._check_command_response(
       [2025/02/19 14:29:28.778] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       [2025/02/19 14:29:28.778] response = {'code': 11, 'codeName': 'UserNotFound', 'conversationId': 1, 'done': True, ...}
       [2025/02/19 14:29:28.778] max_wire_version = 9, allowable_errors = None, parse_write_concern_error = False
       [2025/02/19 14:29:28.778]     def _check_command_response(
       [2025/02/19 14:29:28.778]         response: _DocumentOut,
       [2025/02/19 14:29:28.778]         max_wire_version: Optional[int],
       [2025/02/19 14:29:28.778]         allowable_errors: Optional[Container[Union[int, str]]] = None,
       [2025/02/19 14:29:28.778]         parse_write_concern_error: bool = False,
       [2025/02/19 14:29:28.778]     ) -> None:
       [2025/02/19 14:29:28.778]         """Check the response to a command for errors."""
       [2025/02/19 14:29:28.778]         if "ok" not in response:
       [2025/02/19 14:29:28.778]             # Server didn't recognize our message as a command.
       [2025/02/19 14:29:28.778]             raise OperationFailure(
       [2025/02/19 14:29:28.778]                 response.get("$err"),  # type: ignore[arg-type]
       [2025/02/19 14:29:28.778]                 response.get("code"),
       [2025/02/19 14:29:28.778]                 response,
       [2025/02/19 14:29:28.778]                 max_wire_version,
       [2025/02/19 14:29:28.778]             )
       [2025/02/19 14:29:28.778]         if parse_write_concern_error and "writeConcernError" in response:
       [2025/02/19 14:29:28.778]             _error = response["writeConcernError"]
       [2025/02/19 14:29:28.778]             _labels = response.get("errorLabels")
       [2025/02/19 14:29:28.778]             if _labels:
       [2025/02/19 14:29:28.778]                 _error.update({"errorLabels": _labels})
       [2025/02/19 14:29:28.778]             _raise_write_concern_error(_error)
       [2025/02/19 14:29:28.779]         if response["ok"]:
       [2025/02/19 14:29:28.779]             return
       [2025/02/19 14:29:28.779]         details = response
       [2025/02/19 14:29:28.779]         # Mongos returns the error details in a 'raw' object
       [2025/02/19 14:29:28.779]         # for some errors.
       [2025/02/19 14:29:28.779]         if "raw" in response:
       [2025/02/19 14:29:28.779]             for shard in response["raw"].values():
       [2025/02/19 14:29:28.779]                 # Grab the first non-empty raw error from a shard.
       [2025/02/19 14:29:28.779]                 if shard.get("errmsg") and not shard.get("ok"):
       [2025/02/19 14:29:28.779]                     details = shard
       [2025/02/19 14:29:28.779]                     break
       [2025/02/19 14:29:28.779]         errmsg = details["errmsg"]
       [2025/02/19 14:29:28.779]         code = details.get("code")
       [2025/02/19 14:29:28.779]         # For allowable errors, only check for error messages when the code is not
       [2025/02/19 14:29:28.779]         # included.
       [2025/02/19 14:29:28.779]         if allowable_errors:
       [2025/02/19 14:29:28.779]             if code is not None:
       [2025/02/19 14:29:28.779]                 if code in allowable_errors:
       [2025/02/19 14:29:28.779]                     return
       [2025/02/19 14:29:28.779]             elif errmsg in allowable_errors:
       [2025/02/19 14:29:28.779]                 return
       [2025/02/19 14:29:28.779]         # Server is "not primary" or "recovering"
       [2025/02/19 14:29:28.779]         if code is not None:
       [2025/02/19 14:29:28.779]             if code in _NOT_PRIMARY_CODES:
       [2025/02/19 14:29:28.779]                 raise NotPrimaryError(errmsg, response)
       [2025/02/19 14:29:28.779]         elif HelloCompat.LEGACY_ERROR in errmsg or "node is recovering" in errmsg:
       [2025/02/19 14:29:28.779]             raise NotPrimaryError(errmsg, response)
       [2025/02/19 14:29:28.779]         # Other errors
       [2025/02/19 14:29:28.779]         # findAndModify with upsert can raise duplicate key error
       [2025/02/19 14:29:28.779]         if code in (11000, 11001, 12582):
       [2025/02/19 14:29:28.779]             raise DuplicateKeyError(errmsg, code, response, max_wire_version)
       [2025/02/19 14:29:28.779]         elif code == 50:
       [2025/02/19 14:29:28.779]             raise ExecutionTimeout(errmsg, code, response, max_wire_version)
       [2025/02/19 14:29:28.779]         elif code == 43:
       [2025/02/19 14:29:28.779]             raise CursorNotFound(errmsg, code, response, max_wire_version)
       [2025/02/19 14:29:28.779] >       raise OperationFailure(errmsg, code, response, max_wire_version)
       [2025/02/19 14:29:28.779] E       pymongo.errors.OperationFailure: Could not find user "arn:aws:iam::557821124784:user/authtest_fargate_user" for db "$external", full error: {'conversationId': 1, 'done': True, 'payload': b'', 'ok': 0.0, 'errmsg': 'Could not find user "arn:aws:iam::557821124784:user/authtest_fargate_user" for db "$external"', 'code': 11, 'codeName': 'UserNotFound'}
       [2025/02/19 14:29:28.779] pymongo/helpers_shared.py:250: OperationFailure
      

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            steve.silvester@mongodb.com Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: