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

Log incorrectly prints [Circular] for object property when it shares reference with another property in the same object #228

Closed
CorieW opened this issue Mar 11, 2025 · 0 comments · Fixed by #229
Assignees
Labels
bug Something isn't working triaged Triaged

Comments

@CorieW
Copy link
Contributor

CorieW commented Mar 11, 2025

Same problem was seen in firebase/firebase-functions#1510 for JS/TS

Test case

from firebase_functions import https_fn
from firebase_functions import logger

@https_fn.on_request()
def on_request_example(req: https_fn.Request) -> https_fn.Response:
    common_data = {"foo": "bar"}
    obj1 = {
        "data": common_data,
    }
    obj2 = {
        "data": common_data,
    }
    logger.debug("TEST 1", {"obj1": obj1, "obj2": obj2})
    return https_fn.Response("Oki doki")

Steps to reproduce

  • Call the function
  • View the logs

Expected behavior

When calling the function (e.g. locally) it should log with the json payload:

{
  "obj1": { "data": { "foo": "bar" } },
  "obj2": { "data": { "foo": "bar" } },
  "severity": "DEBUG",
  "message": "TEST 1"
}

Actual behavior

Instead it prints the following payload:

{
  "obj1": { "data": { "foo": "bar" } },
  "obj2": { "data": "[Circular]" },
  "severity": "DEBUG",
  "message": "TEST 1"
}

Were you able to successfully deploy your functions?

Yes, I had the same issue when viewing the logs in the log explorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant