diff --git a/vertexai/rag/rag_data.py b/vertexai/rag/rag_data.py index a1eaa98120..fd4ca0d7e6 100644 --- a/vertexai/rag/rag_data.py +++ b/vertexai/rag/rag_data.py @@ -428,7 +428,9 @@ def upload_file( "metadata": (None, str(js_rag_file)), "file": open(path, "rb"), } - credentials, _ = auth.default() + credentials = initializer.global_config.credentials + if not credentials: + credentials, _ = auth.default() authorized_session = google_auth_requests.AuthorizedSession(credentials=credentials) try: response = authorized_session.post(