Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase emulator, query collection gets stuck under pipenv environment #555

Closed
tsikerdekis opened this issue Jun 4, 2021 · 5 comments
Closed

Comments

@tsikerdekis
Copy link

  • Operating System version: Ubuntu 20.04
  • Firebase SDK version: 9.12.1
  • Library version: firebase_admin - 4.4.0
  • Firebase Product: Emulator

I have the following code:

    import firebase_admin
    from firebase_admin import credentials
    from firebase_admin import firestore
    os.environ["FIRESTORE_EMULATOR_HOST"] = "127.0.0.1:8080"
    os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "emulator_config.json"
    docs = db.collection(u'insights/venues/queue').stream()
    for doc_ref in docs:
      pass

Works without issues on my general python environment and under my pipenv environment when connecting to google cloud.

My pipenv environment is:

    [[source]]
    url = "https://pypi.python.org/simple"
    verify_ssl = true
    name = "pypi"
    
    [packages]
    keras = "*"
    requests-html = "*"
    sklearn = "*"
    pandas = "*"
    bs4 = "*"
    lxml = "*"
    refextract = "*"
    numpy = "*"
    firebase-admin = "*"
    tensorflow-cpu = "==2.4.1"
    
    [dev-packages]
    
    [requires]
    python_version = "3.8"

When I have the emulator on however, it works under my main python environment but under the pipenv, the code gets stuck in the for loop. It does not proceed, it just hangs there.

For the emulator portion of code, I am using:

  os.environ["FIRESTORE_EMULATOR_HOST"] = "127.0.0.1:8080"
   os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "emulator_config.json"
   cred = credentials.ApplicationDefault()
   firebase_admin.initialize_app(cred, {
       'projectId': 'someproject-3',
   })
   db = firestore.client()

The emulator config is:

{
  	"type": "service_account",
  	"project_id": "mock-project-id",
  	"private_key_id": "mock-key-id-1",
          "private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAwJENcRev+eXZKvhhWLiV3Lz2MvO+naQRHo59g3vaNQnbgyduN/L4krl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MqnE+OBvfkGGBtw22S\nLesx6sWf99Ov58+x4Q0U5dpxL0Lb7d2Z+2Dtp+Z4jXFjNeeI4ae/qG/LOR/b0pE0J5F415ap\n7Mpq5v89vepUtrkCgYAjMXytu4v+q1Ikhc4UmRPDrUUQ1WVSd+9u19yKlnFGTFnRjej86hiw\nH3jPxBhHra0a53EgiilmsBGSnWpl1WH4EmJz5vBCKUAmjgQiBrueIqv9iHiaTNdjsanUyaWw\njyxXfXl2eI80QPXh02+8g1H/pzESgjK7Rg1AqnkfVH9nrwKBgQDJVxKBPTw9pigYMVt9iHrR\niCl9zQVjRMbWiPOc0J56+/5FZYm/AOGl9rfhQ9vGxXZYZiOP5FsNkwt05Y1UoAAH4B4VQwbL\nqod71qOcI0ywgZiIR87CYw40gzRfjWnN+YEEW1qfyoNLilEwJB8iB/T+ZePHGmJ4MmQ/cTn9\nxpdLXA==\n-----END RSA PRIVATE KEY-----",
  	"client_email": "mock-email@mock-project.iam.gserviceaccount.com",
  	"client_id": "1234567890",
  	"auth_uri": "https://accounts.google.com/o/oauth2/auth",
  	"token_uri": "https://accounts.google.com/o/oauth2/token",
  	"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  	"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/mock-project-id.iam.gserviceaccount.com"
  }

Error when interrupting stuck process:

Traceback (most recent call last):
  File "main.py", line 346, in <module>
    main()
  File "main.py", line 83, in main
    for doc_ref in docs:
  File "/home/user/.local/share/virtualenvs/cron-I5fFJfVY/lib/python3.8/site-packages/google/cloud/firestore_v1/query.py", line 208, in stream
    response_iterator = self._client._firestore_api.run_query(
  File "/home/user/.local/share/virtualenvs/cron-I5fFJfVY/lib/python3.8/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 965, in run_query
    response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/home/user/.local/share/virtualenvs/cron-I5fFJfVY/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
    return wrapped_func(*args, **kwargs)
  File "/home/user/.local/share/virtualenvs/cron-I5fFJfVY/lib/python3.8/site-packages/google/api_core/retry.py", line 285, in retry_wrapped_func
    return retry_target(
  File "/home/user/.local/share/virtualenvs/cron-I5fFJfVY/lib/python3.8/site-packages/google/api_core/retry.py", line 219, in retry_target
    time.sleep(sleep)

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@hiranya911
Copy link
Contributor

Might have to report directly at the Python Firestore client: https://github.com/googleapis/python-firestore

@hiranya911
Copy link
Contributor

@crwilcox @schmidt-sebastian FYA

@tsikerdekis
Copy link
Author

Thank, I found a related issue:
googleapis/python-firestore#359

@hiranya911
Copy link
Contributor

Closing as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants