Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

raise exceptions.from_grpc_error(exc) from exc google.api_core.exceptions.Unknown: None Stream removed

Abierto
#633 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
django, firebase, grpc, python

Línea de trabajo

No se identifica ningún archivo del repositorio, prueba ni punto de entrada en firebase-admin-python; el informe señala los views.py, FirestoreManager.py y el flujo de streaming de consultas de Firestore del usuario. Empieza reproduciendo el caso «idle-then-GET» con las versiones de paquete indicadas e inspecciona la ruta de streaming de Firestore. Para darlo por terminado se requiere un defecto confirmado del SDK, una corrección acotada y una prueba de regresión.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs-triage

I am developing a web project with Django.

I use Firebase's Firestore as my database.

Look at the views.py "def mail(request)" you can see I get data from firestore and render to 'mail.html'

And I go to http://127.0.0.1:8000/resource/mail/ is normal.

But if I do nothing lasts 5 minutes and reorganize this page,
I will get this error on my web.

I think my problem like this https://stackoverflow.com/questions/70446165/firestore-stream-removed-error-after-3-minutes-doing-nothing
,although it is .NET and my project is python.

Anyway the website is very normal at first,but after maybe 3~5 minutes it get error.

    Unknown at /resource/mail/
    None Stream removed
    Request Method:	GET
    Request URL:	http://127.0.0.1:8000/resource/mail/
    Django Version:	4.0.6
    Exception Type:	Unknown
    Exception Value:	
    None Stream removed
    Exception Location:	C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py, line 144, in error_remapped_callable
    Python Executable:	C:\Users\USER\.conda\envs\Backstage\python.exe
    Python Version:	3.9.12
    Python Path:	
    ['C:\\Users\\USER\\Desktop\\官網+後台\\Backstage',
    'C:\\Users\\USER\\.conda\\envs\\Backstage\\python39.zip',
    'C:\\Users\\USER\\.conda\\envs\\Backstage\\DLLs',
    'C:\\Users\\USER\\.conda\\envs\\Backstage\\lib',
    'C:\\Users\\USER\\.conda\\envs\\Backstage',
    'C:\\Users\\USER\\.conda\\envs\\Backstage\\lib\\site-packages']
    Server time:	Fri, 05 Aug 2022 17:01:33 +0800


    Traceback Switch to copy-and-paste view
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py, line 140, in error_remapped_callable
                return _StreamingResponseIterator( …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py, line 66, in __init__
                    self._stored_first_result = next(self._wrapped) …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\grpc\_channel.py, line 426, in __next__
            return self._next() …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\grpc\_channel.py, line 826, in _next
                        raise self …
    Local vars
    The above exception (<_MultiThreadedRendezvous of RPC that terminated with: status = StatusCode.UNKNOWN details = "Stream removed" debug_error_string = "{"created":"@1659690093.393000000","description":"Error received from peer ipv4:172.217.163.42:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Stream removed","grpc_status":2}" >) was the direct cause of the following exception:
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\django\core\handlers\exception.py, line 55, in inner
                    response = get_response(request) …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\django\core\handlers\base.py, line 197, in _get_response
                    response = wrapped_callback(request, *callback_args, **callback_kwargs) …
    Local vars
    C:\Users\USER\Desktop\官網+後台\Backstage\myproject\views\resource.py, line 36, in mail
        for doc in docs: …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\cloud\firestore_v1\query.py, line 273, in stream
            response_iterator, expected_prefix = self._get_stream_iterator( …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\cloud\firestore_v1\query.py, line 218, in _get_stream_iterator
            response_iterator = self._client._firestore_api.run_query( …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\cloud\firestore_v1\services\firestore\client.py, line 1237, in run_query
            response = rpc( …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\gapic_v1\method.py, line 154, in __call__
            return wrapped_func(*args, **kwargs) …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\retry.py, line 283, in retry_wrapped_func
                return retry_target( …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\retry.py, line 190, in retry_target
                return target() …
    Local vars
    C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py, line 144, in error_remapped_callable
                raise exceptions.from_grpc_error(exc) from exc …
    Local vars

urls.py:

    from django.contrib import admin
    from django.urls import path
    from myproject.views import *

    urlpatterns = [
        path('admin/', admin.site.urls),
        path('signup/', signup,name='signup'),#註冊
        path('login/', login),#登入
        path('index/', index),#主頁
        path('tradeQuery/', tradequery),#交易狀態查詢
        path('resource/mail/', mail),#送禮系統


]

views.py:

    def mail(request):
      docs=FirestoreManager.getDocsWhereTime("BackendLog-Mail") 
      for doc in docs:
          print(doc.to_dict())
      return render(request, 'mail.html', locals())

FirestoreManager.py:

    def getDocsWhereTime(*args): # 傳入參數為 collection_name,start_time,end_time
      if len(args)>0:
          collection_name=args[0]
      if len(args)>1:
          start_time=args[1]
      else:
          start_time=datetime(2022,8,1).astimezone(timezone(offset=timedelta(hours=8)))
      if len(args)>2:
          end_time=args[2]
      else:
          end_time=datetime.now(tz=timezone(timedelta(hours=8)))
      docs = db.collection(collection_name).where("CreateTime", '>=', start_time).where("CreateTime", "<", end_time).stream()
      return docs

requirements.txt:

    Django==4.0.6
    firebase-admin==5.1.0
    google-api-core==2.8.2
    google-api-python-client==2.55.0
    google-auth==2.9.1
    google-auth-httplib2==0.1.0
    google-cloud-core==2.3.2
    google-cloud-firestore==2.6.0
    google-cloud-storage==2.4.0
    google-crc32c==1.3.0
    google-resumable-media==2.3.3
    googleapis-common-protos==1.56.4
    grpcio==1.47.0

cmd console:

    Internal Server Error: /resource/mail/
    Traceback (most recent call last):
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py", line 140, in error_remapped_callable
        return _StreamingResponseIterator(
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py", line 66, in __init__
        self._stored_first_result = next(self._wrapped)
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\grpc\_channel.py", line 426, in __next__
        return self._next()
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\grpc\_channel.py", line 826, in _next
        raise self
    grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
            status = StatusCode.UNKNOWN
            details = "Stream removed"
            debug_error_string = "{"created":"@1659690093.393000000","description":"Error received from peer ipv4:172.217.163.42:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Stream removed","grpc_status":2}"
    >
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
        response = get_response(request)
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "C:\Users\USER\Desktop\官網+後台\Backstage\myproject\views\resource.py", line 36, in mail
        for doc in docs:
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\cloud\firestore_v1\query.py", line 273, in stream
        response_iterator, expected_prefix = self._get_stream_iterator(
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\cloud\firestore_v1\query.py", line 218, in _get_stream_iterator
        response_iterator = self._client._firestore_api.run_query(
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\cloud\firestore_v1\services\firestore\client.py", line 1237, in run_query
        response = rpc(
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\gapic_v1\method.py", line 154, in __call__
        return wrapped_func(*args, **kwargs)
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\retry.py", line 283, in retry_wrapped_func
        return retry_target(
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\retry.py", line 190, in retry_target
        return target()
      File "C:\Users\USER\.conda\envs\Backstage\lib\site-packages\google\api_core\grpc_helpers.py", line 144, in error_remapped_callable
        raise exceptions.from_grpc_error(exc) from exc
    google.api_core.exceptions.Unknown: None Stream removed
    [05/Aug/2022 17:01:33] "GET /resource/mail/ HTTP/1.1" 500 125693

Lenguaje dominante
Python
Estrellas
1.2k
Forks
359
Merge medio
3 d 9 h
PR fusionados (30 d)
3

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/firebase-admin-python

Todos los issues de firebase/firebase-admin-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.