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

Failed to parse httpRequest field: 'HttpRequest' object is not iterable. #155

Closed
JohnGale87 opened this issue Jan 13, 2021 · 1 comment · Fixed by #156
Closed

Failed to parse httpRequest field: 'HttpRequest' object is not iterable. #155

JohnGale87 opened this issue Jan 13, 2021 · 1 comment · Fixed by #156
Assignees
Labels
api: logging Issues related to the googleapis/python-logging API. triage me I really want to be triaged.

Comments

@JohnGale87
Copy link

I am using a flask app, but none of my logs are successful, they always leave an error in the logs. Seems to be related to the newly released PR #120 ?

Environment details

  • OS type and version: macOS 10.15.5
  • Python version: Python 3.7.1
  • pip version: pip 20.3.3
  • google-cloud-logging version: 2.1.0

Steps to reproduce

  1. Get the appengine python 3 hello world sample app
  2. Add some basic cloud logging to it.
  3. Deploy to appengine.
  4. See error in the logs.

Code example

import logging

from google.cloud import logging as cloud_logging

@app.route('/')
def hello_world():
    logging_client = cloud_logging.Client()
    logging_client.setup_logging(log_level=logging.INFO)
    logging.info('hello')
    return 'world'

Stack trace

File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/logging_v2/handlers/transports/background_thread.py", line 115, in _safely_commit_batch
    batch.commit()
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/logging_v2/logger.py", line 382, in commit
    client.logging_api.write_entries(entries, **kwargs)
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/logging_v2/_gapic.py", line 140, in write_entries
    log_entry_pbs = [_log_entry_mapping_to_pb(entry) for entry in entries]
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/logging_v2/_gapic.py", line 140, in <listcomp>
    log_entry_pbs = [_log_entry_mapping_to_pb(entry) for entry in entries]
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/logging_v2/_gapic.py", line 507, in _log_entry_mapping_to_pb
    ParseDict(mapping, entry_pb)
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/protobuf/json_format.py", line 454, in ParseDict
    parser.ConvertMessage(js_dict, message)
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/protobuf/json_format.py", line 485, in ConvertMessage
    self._ConvertFieldValuePair(value, message)
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/protobuf/json_format.py", line 603, in _ConvertFieldValuePair
    raise ParseError('Failed to parse {0} field: {1}.'.format(name, e))
google.protobuf.json_format.ParseError: Failed to parse httpRequest field: 'HttpRequest' object is not iterable."  
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/python-logging API. label Jan 13, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jan 14, 2021
@daniel-sanche
Copy link
Contributor

Thanks for reporting this, I'm not sure how it got through the tests. I opened a PR to resolve it, and will try to push out a fix release today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/python-logging API. triage me I really want to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants