调用Vertex AI端点预测时遭遇503 DNS解析失败错误的求助
调用Vertex AI端点预测时遭遇503 DNS解析失败错误的求助
我现在正尝试调用自定义Vertex AI端点做预测,但一直碰到下面的错误,完全摸不着头脑。我已经试过这些排查步骤了:
- 反复核对了端点ID和项目编号
- 所有Python包都是最新版本
- Google Cloud日志里没找到相关错误
- Vertex AI API已经启用
- Vertex AI API服务账号权限配置正确
- 没有触发配额或其他限制
- 创建端点时勾选了DNS选项
- 尝试过用VPN连接
- 换了两个操作系统、三种不同网络环境测试,排除本地网络问题
代码示例
from google.cloud import aiplatform PROJECT_NUMBER = "..." REGION = "us-central1" ENDPOINT_ID = "..." # Initialize Vertex AI with the dedicated domain name aiplatform.init( project=PROJECT_NUMBER, location=REGION, api_endpoint=f"{ENDPOINT_ID}.us-central1-{PROJECT_NUMBER}.prediction.vertexai.goog" ) endpoint_name = f"projects/{PROJECT_NUMBER}/locations/{REGION}/endpoints/{ENDPOINT_ID}" endpoint = aiplatform.Endpoint(endpoint_name=endpoint_name) response = endpoint.predict(instances=[{"content": "Hello world"}], use_dedicated_endpoint=True) print(response)
错误信息
Traceback (most recent call last): File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\grpc_helpers.py", line 76, in error_remapped_callable return callable_(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc\_interceptor.py", line 277, in __call__ response, ignored_call = self._with_call( ^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc\_interceptor.py", line 332, in _with_call return call.result(), call ^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc\_channel.py", line 440, in result raise self File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc\_interceptor.py", line 315, in continuation response, call = self._thunk(new_method).with_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc\_channel.py", line 1198, in with_call return _end_unary_response_blocking(state, call, True, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc\_channel.py", line 1006, in _end_unary_response_blocking raise _InactiveRpcError(state) # pytype: disable=not-instantiable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNAVAILABLE details = "DNS resolution failed for ENDPOINT_ID.us-central1-PROJECT_NUMBER.prediction.vertexai.goog:443: UNAVAILABLE: getaddrinfo: WSA Error (No such host is known. -- 11001)" debug_error_string = "UNKNOWN:Error received from peer {created_time:"2025-03-31T12:27:51.0519886+00:00", grpc_status:14, grpc_message:"DNS resolution failed for ENDPOINT_ID.us-central1-PROJECT_NUMBER.prediction.vertexai.goog:443: UNAVAILABLE: getaddrinfo: WSA Error (No such host is known.\r\n -- 11001)"}" > The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\retry\retry_unary.py", line 144, in retry_target result = target() ^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\grpc_helpers.py", line 78, in error_remapped_callable raise exceptions.from_grpc_error(exc) from exc google.api_core.exceptions.ServiceUnavailable: 503 DNS resolution failed for ENDPOINT_ID.us-central1-PROJECT_NUMBER.prediction.vertexai.goog:443: UNAVAILABLE: getaddrinfo: WSA Error (No such host is known. -- 11001) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\Users\zacis\Desktop\New folder\FootySphere (1)\Code\site\d.py", line 17, in <module> response = endpoint.predict(instances=[{"content": "Hello world"}], use_dedicated_endpoint=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\cloud\aiplatform\models.py", line 2384, in predict self._sync_gca_resource_if_skipped() File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\cloud\aiplatform\models.py", line 742, in _sync_gca_resource_if_skipped self._gca_resource = self._get_gca_resource( ^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\cloud\aiplatform\base.py", line 692, in _get_gca_resource return getattr(self.api_client, self._getter_method)( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\cloud\aiplatform_v1\services\endpoint_service\client.py", line 1133, in get_endpoint response = rpc( ^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\gapic_v1\method.py", line 131, in __call__ return wrapped_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\retry\retry_unary.py", line 293, in retry_wrapped_func return retry_target( ^^^^^^^^^^^^^ File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\retry\retry_unary.py", line 153, in retry_target _retry_error_helper( File "c:\Users\zacis\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\retry\retry_base.py", line 221, in _retry_error_helper raise final_exc from source_exc google.api_core.exceptions.RetryError: Timeout of 120.0s exceeded, last exception: 503 DNS resolution failed for ENDPOINT_ID.us-central1-PROJECT_NUMBER.prediction.vertexai.goog:443: UNAVAILABLE: getaddrinfo: WSA Error (No such host is known. -- 11001)
备注:内容来源于stack exchange,提问作者ahmedquran12
相关产品推荐
相关产品推荐

