|
6 | 6 | import threading |
7 | 7 | from typing import Any, Dict, List, Optional, Tuple |
8 | 8 | from uuid import uuid4 |
9 | | - |
10 | 9 | from cachetools import TTLCache |
11 | 10 | import requests |
12 | 11 | from postgrest._sync.request_builder import SyncQueryRequestBuilder |
|
18 | 17 | from supabase.lib.client_options import ClientOptions |
19 | 18 |
|
20 | 19 | from robusta.core.model.cluster_status import ClusterStatus |
| 20 | +from robusta.core.exceptions import SupabaseDnsException |
21 | 21 | from robusta.core.model.env_vars import SUPABASE_TIMEOUT_SECONDS |
22 | 22 | from robusta.core.model.helm_release import HelmRelease |
23 | 23 | from robusta.core.model.jobs import JobInfo |
@@ -541,10 +541,29 @@ def publish_helm_releases(self, helm_releases: List[HelmRelease]): |
541 | 541 |
|
542 | 542 | def sign_in(self) -> str: |
543 | 543 | logging.info("Supabase dal login") |
544 | | - res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password}) |
545 | | - self.client.auth.set_session(res.session.access_token, res.session.refresh_token) |
546 | | - self.client.postgrest.auth(res.session.access_token) |
547 | | - return res.user.id |
| 544 | + try: |
| 545 | + res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password}) |
| 546 | + self.client.auth.set_session(res.session.access_token, res.session.refresh_token) |
| 547 | + self.client.postgrest.auth(res.session.access_token) |
| 548 | + return res.user.id |
| 549 | + except Exception as e: |
| 550 | + # Check if this is a DNS-related error |
| 551 | + error_msg = str(e).lower() |
| 552 | + if any(dns_indicator in error_msg for dns_indicator in [ |
| 553 | + "temporary failure in name resolution", |
| 554 | + "name resolution", |
| 555 | + "dns", |
| 556 | + "name or service not known", |
| 557 | + "nodename nor servname provided" |
| 558 | + ]): |
| 559 | + message = ( |
| 560 | + f"\n{e}\nCannot connect to Robusta SaaS <{self.url}>. " |
| 561 | + f"\nThis is often due to DNS issues or Firewall policies. " |
| 562 | + f"\nPlease run the following command in your cluster and verify it does not print 'Could not resolve host': " |
| 563 | + f"\ncurl -I {self.url}\n" |
| 564 | + ) |
| 565 | + raise SupabaseDnsException(message) from e |
| 566 | + raise |
548 | 567 |
|
549 | 568 | def to_db_cluster_status(self, data: ClusterStatus) -> Dict[str, Any]: |
550 | 569 | db_cluster_status = data.dict() |
|
0 commit comments