Skip to content

Conformance tests are failing #148

Description

@di

The write_legacy_event conformance test has started failing on the master branch: https://github.com/GoogleCloudPlatform/functions-framework-python/runs/3414035673

def write_legacy_event(data, context):
_write_output(
json.dumps(
{
"data": data,
"context": {
"eventId": context.event_id,
"timestamp": context.timestamp,
"eventType": context.event_type,
"resource": context.resource,
},
}
)
)

Stacktrace seems to indicate that it's trying to serialize non-serializable data:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/site-packages/flask/app.py", line 2070, in wsgi_app
2021/08/24 17:48:54 Events tried:
    response = self.full_dispatch_request()
	- firebase-auth (PASSED)
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/site-packages/flask/app.py", line 1515, in full_dispatch_request
	- firebase-db1 (PASSED)
    rv = self.handle_user_exception(e)
	- firebase-db2 (PASSED)
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/site-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/site-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/runner/work/functions-framework-python/functions-framework-python/src/functions_framework/__init__.py", line 143, in view_func
    function(data, context)
  File "/home/runner/work/functions-framework-python/functions-framework-python/tests/conformance/main.py", line 20, in write_legacy_event
    json.dumps(
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

Seems likely that data is now being sent as bytes here and needs decoded first.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions