Skip to content

Commit ae7ac7a

Browse files
committed
Restrict to server only
1 parent 3634b61 commit ae7ac7a

File tree

3 files changed

+37
-35
lines changed

3 files changed

+37
-35
lines changed

backend/onyx/background/indexing/run_indexing.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from onyx.configs.app_configs import INDEX_BATCH_SIZE
1616
from onyx.configs.app_configs import INDEXING_SIZE_WARNING_THRESHOLD
1717
from onyx.configs.app_configs import INDEXING_TRACER_INTERVAL
18-
from onyx.configs.app_configs import INTEGRATION_TESTS_MODE
1918
from onyx.configs.app_configs import LEAVE_CONNECTOR_ACTIVE_ON_INITIALIZATION_FAILURE
2019
from onyx.configs.app_configs import POLL_CONNECTOR_OFFSET
2120
from onyx.configs.constants import DocumentSource
@@ -97,8 +96,8 @@ def _get_connector_runner(
9796
)
9897

9998
# validate the connector settings
100-
if not INTEGRATION_TESTS_MODE:
101-
runnable_connector.validate_connector_settings()
99+
# if not INTEGRATION_TESTS_MODE:
100+
# runnable_connector.validate_connector_settings()
102101

103102
except UnexpectedValidationError as e:
104103
logger.exception(

backend/onyx/connectors/confluence/connector.py

+27-30
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from typing import Any
66
from urllib.parse import quote
77

8-
from requests.exceptions import HTTPError
98
from typing_extensions import override
109

1110
from onyx.configs.app_configs import CONFLUENCE_CONNECTOR_LABELS_TO_SKIP
@@ -22,10 +21,6 @@
2221
from onyx.connectors.confluence.utils import process_attachment
2322
from onyx.connectors.confluence.utils import update_param_in_path
2423
from onyx.connectors.confluence.utils import validate_attachment_filetype
25-
from onyx.connectors.exceptions import ConnectorValidationError
26-
from onyx.connectors.exceptions import CredentialExpiredError
27-
from onyx.connectors.exceptions import InsufficientPermissionsError
28-
from onyx.connectors.exceptions import UnexpectedValidationError
2924
from onyx.connectors.interfaces import CheckpointedConnector
3025
from onyx.connectors.interfaces import CheckpointOutput
3126
from onyx.connectors.interfaces import ConnectorCheckpoint
@@ -645,28 +640,30 @@ def retrieve_all_slim_documents(
645640
yield doc_metadata_list
646641

647642
def validate_connector_settings(self) -> None:
648-
try:
649-
spaces = self.low_timeout_confluence_client.get_all_spaces(limit=1)
650-
except HTTPError as e:
651-
status_code = e.response.status_code if e.response else None
652-
if status_code == 401:
653-
raise CredentialExpiredError(
654-
"Invalid or expired Confluence credentials (HTTP 401)."
655-
)
656-
elif status_code == 403:
657-
raise InsufficientPermissionsError(
658-
"Insufficient permissions to access Confluence resources (HTTP 403)."
659-
)
660-
raise UnexpectedValidationError(
661-
f"Unexpected Confluence error (status={status_code}): {e}"
662-
)
663-
except Exception as e:
664-
raise UnexpectedValidationError(
665-
f"Unexpected error while validating Confluence settings: {e}"
666-
)
667-
668-
if not spaces or not spaces.get("results"):
669-
raise ConnectorValidationError(
670-
"No Confluence spaces found. Either your credentials lack permissions, or "
671-
"there truly are no spaces in this Confluence instance."
672-
)
643+
# Freezing often, just removing for now
644+
return None
645+
# try:
646+
# spaces = self.low_timeout_confluence_client.get_all_spaces(limit=1)
647+
# except HTTPError as e:
648+
# status_code = e.response.status_code if e.response else None
649+
# if status_code == 401:
650+
# raise CredentialExpiredError(
651+
# "Invalid or expired Confluence credentials (HTTP 401)."
652+
# )
653+
# elif status_code == 403:
654+
# raise InsufficientPermissionsError(
655+
# "Insufficient permissions to access Confluence resources (HTTP 403)."
656+
# )
657+
# raise UnexpectedValidationError(
658+
# f"Unexpected Confluence error (status={status_code}): {e}"
659+
# )
660+
# except Exception as e:
661+
# raise UnexpectedValidationError(
662+
# f"Unexpected error while validating Confluence settings: {e}"
663+
# )
664+
665+
# if not spaces or not spaces.get("results"):
666+
# raise ConnectorValidationError(
667+
# "No Confluence spaces found. Either your credentials lack permissions, or "
668+
# "there truly are no spaces in this Confluence instance."
669+
# )

backend/onyx/connectors/confluence/onyx_confluence.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,9 @@ def _paginate_url(
465465
)
466466
continue
467467

468-
if raw_response.status_code == 500:
468+
# this iterative approach only works for server, since cloud uses cursor-based
469+
# pagination
470+
if raw_response.status_code == 500 and not self._is_cloud:
469471
# in the case of a 500 error, go one by one until we find the error
470472
# and skip the error
471473
results: list[dict[str, Any]] = []
@@ -480,6 +482,7 @@ def _paginate_url(
480482

481483
found_empty_page = False
482484
temp_url_suffix = url_suffix
485+
ind = 0
483486
for ind in range(limit):
484487
try:
485488
temp_url_suffix = update_param_in_path(
@@ -510,14 +513,17 @@ def _paginate_url(
510513
)
511514

512515
if found_empty_page:
516+
if next_page_callback:
517+
next_page_callback("")
513518
break
514519

515520
# since we manually tried up to limit, we can just update the start
516521
url_suffix = update_param_in_path(
517-
url_suffix, "start", str(initial_start + limit)
522+
url_suffix, "start", str(initial_start + ind + 1)
518523
)
519524
if next_page_callback:
520525
next_page_callback(url_suffix)
526+
521527
continue
522528

523529
else:

0 commit comments

Comments
 (0)