ECONNRESET connecting to Firebase auth emulator from functions emulator with grpc imported

未关闭
#945 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
43/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
grpc, python

调研方向

从 issue 中链接的最小复现 repository 开始,并在已导入 grpc 或 firebase_admin.firestore 的情况下运行其中的 Python cloud function。复现对 Auth emulator 的调用或对 http://127.0.0.1:9099/ 的 GET 请求,并跟踪 ECONNRESET 发生的位置;在该设置下请求完成且没有 socket hang-up 即表示完成。

由索引模型根据 Issue 内容生成。

描述

[READ] Step 1: Are you in the right place?

I’m not sure that the root cause of this issue is, but this repo seems like the most likely culprit. Other possibilities: gRPC, firebase-tools, firebase-functions.

[REQUIRED] Step 2: Describe your environment
  • Operating System version: macOS 15.7.4 (24G517)
  • Firebase SDK version: 7.4.0
  • Firebase Product: auth
  • Python version: 3.11.15
  • Pip version: uv 0.11.6
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:

danielparks/firebase-emulator-auth-hang-up is minimal test repo with more exhaustive details including a workaround.

Within a Python cloud function that has grpc or firebase_admin.firestore imported, call an auth method, e.g. auth.create_user(...), or make a GET request to the auth endpoint, e.g. requests.get("http://127.0.0.1:9099/", timeout=1).

The function will fail with ECONNRESET (“Error: socket hang up”).

Relevant Code:

Simplified example (see the repo above for a functional example):

from firebase_admin import initialize_app
from firebase_functions import https_fn
import requests

import grpc
# or, import firebase_admin.firestore

initialize_app()

@https_fn.on_call()
def connect(req):
    # Make a simple GET request to the auth emulator endpoint:
    return repr(requests.get("http://127.0.0.1:9099/", timeout=1))
主要语言
Python
星标
1.2k
派生
359
平均合并
5 天 6 分钟
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/firebase-admin-python 的其他 Issue

查看 firebase/firebase-admin-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。