Localhost unavailable: WSA error
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
首先,使用顯示的 FIRESTORE_EMULATOR_HOST 值以及列出的 Python、Windows 和 emulator 版本,重現 main.py 中的失敗。透過 google.api_core 和 grpc 閱讀 traceback,然後將 Python 用戶端對 emulator 連線的處理方式與正常運作的雲端設定進行比較。完成的標準是找出可重現的 SDK 或環境原因,並新增有針對性的回歸測試或明確支援的設定指南。
由索引模型根據 Issue 內容生成。
描述
[REQUIRED] Step 2: Describe your environment
- Operating System version: Windows 10
- Firebase SDK version: 12.4.2
- Firebase Product: firestore (auth, database, storage, etc)
- Python version: 3.10.13
- Pip version: 23.2.1
[REQUIRED] Step 3: Describe the problem
I'm dealing with a Python+Emulator problem. My emulator works in Flutter, but not in Python, and it works in Python on Cloud Firestore. It's only the Python+Emulator combo that is giving me trouble.
It was working earlier today, but so far my backtracking attempts have been unsuccessful.
I've tried restarting my machine, and the emulator, but neither have worked so far.
Steps to reproduce:
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
Traceback (most recent call last):
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\grpc_helpers.py", line 162, in error_remapped_callable
return _StreamingResponseIterator(
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\grpc_helpers.py", line 88, in __init__
self._stored_first_result = next(self._wrapped)
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\grpc\_channel.py", line 541, in __next__
return self._next()
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\grpc\_channel.py", line 967, in _next
raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "DNS resolution failed for http://localhost:8080: UNAVAILABLE: WSA Error"
debug_error_string = "UNKNOWN:DNS resolution failed for http://localhost:8080: UNAVAILABLE: WSA Error {created_time:"2023-10-07T20:33:00.4853876+00:00", grpc_status:14}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\retry.py", line 191, in retry_target
return target()
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\timeout.py", line 120, in func_with_timeout
return func(*args, **kwargs)
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\grpc_helpers.py", line 166, in error_remapped_callable
raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.ServiceUnavailable: 503 DNS resolution failed for http://localhost:8080: UNAVAILABLE: WSA Error
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "d:\Projects\info_extractor\main.py", line 66, in <module>
print(doc_ref.get())
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\cloud\firestore_v1\query.py", line 172, in get
return list(result)
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\cloud\firestore_v1\query.py", line 287, in stream
response_iterator, expected_prefix = self._get_stream_iterator(
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\cloud\firestore_v1\query.py", line 221, in _get_stream_iterator
response_iterator = self._client._firestore_api.run_query(
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\cloud\firestore_v1\services\firestore\client.py", line
1309, in run_query
response = rpc(
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\gapic_v1\method.py", line 113, in __call__
return wrapped_func(*args, **kwargs)
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\retry.py", line 349, in retry_wrapped_func
return retry_target(
File "D:\Programs\anaconda3\envs\info_extractor\lib\site-packages\google\api_core\retry.py", line 207, in retry_target
raise exceptions.RetryError(
google.api_core.exceptions.RetryError: Deadline of 300.0s exceeded while calling target function, last exception: 503 DNS resolution failed for http://localhost:8080: UNAVAILABLE: WSA Error
Also, this comes out of one of the emulator processes (unsure which):
Oct 07, 2023 8:54:35 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Relevant Code:
My .env:
FIRESTORE_EMULATOR_HOST=http://localhost:8080
STORAGE_EMULATOR_HOST=http://localhost:9199
When I remove http:// from the variables, I get instead that no connection adapters are available.
import firebase_admin
def initialize_firestore():
app = firebase_admin.initialize_app()
db = firestore.client()
return app, db
if __name__ == "__main__":
callback_done = threading.Event()
app, db =initialize_firestore()
doc_ref = db.collection('files').where(
filter=FieldFilter('extractedText', '==', ''))
print(doc_ref.get())
print('Statement complete')
Code hangs on the second-to-last statement. It works fine on Google Cloud, it's only on emulator that it doesn't work, which is why I'm posting here.
- 主要語言
- Python
- 星號
- 1.2k
- 分支
- 362
- 平均合併
- 8 小時 7 分鐘
- 30 天內合併 PR
- 3
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
firebase/firebase-admin-python 的其他 Issue
-
Fix typos and wrong types in remote_config.py可能已有人在做 @Shubham-Padkonde 於 11 天前認領。 未關閉api: remoteconfig
難度 2/5 1-3 小時 新手友好度 75/100
firebase/firebase-admin-python#957 · 1 則留言 ·
維護者通常 1 天內回覆
-
api: database type: feature request
難度 2/5 1-3 小時 新手友好度 62/100
firebase/firebase-admin-python#58 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 45/100
firebase/firebase-admin-python#978 · 1 則留言 ·
維護者通常 1 天內回覆
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node)可能已有人在做 @lahirumaramba 於 153 天前認領。 未關閉api: auth
firebase/firebase-admin-python#949 · 2 則留言 · 1 個 reaction · 已指派 1 人 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
firebase/firebase-admin-python#945 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 firebase/firebase-admin-python 的全部 Issue
相似的 Issue
-
bug needs-triage
難度 2/5 1-3 小時 新手友好度 68/100
debpalash/VoiceStudio#2624 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
-
SQLGlot translates Spark concat_ws on an array into array stringification可能已有人在做 @ansh-rohilla 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
Make Catch2 optional when `RDK_BUILD_CPP_TESTS=OFF`可能已有人在做 @pechersky 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 2 天內回覆