Skip to content

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

@JohnGale87

Description

@JohnGale87

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."  

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/python-logging API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions