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 #1510

Open
brjakab opened this issue Jan 5, 2024 · 2 comments

Comments

@brjakab
Copy link

brjakab commented Jan 5, 2024

Related issues

[REQUIRED] Version info

node: 18.19.0

firebase-functions: 4.6.0

firebase-tools: 12.9.1

firebase-admin: 11.11.0

[REQUIRED] Test case

My function is the following:

import { onCall } from "firebase-functions/v2/https";
import { logger } from "firebase-functions/v2";

export const testFunction = onCall(
  {
    region: "europe-west1",
  },
  (request) => {
    const commonData = { foo: "bar" }
    const obj1 = {
      data: commonData,

    }
    const obj2 = {
      data: commonData,

    }
    logger.debug("TEST 1", { obj1, obj2 })
  }
);

[REQUIRED] Steps to reproduce

  • Call the function
  • View the logs

[REQUIRED] 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"
}

[REQUIRED] 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.

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@OskarGroth
Copy link

OskarGroth commented Aug 24, 2024

Also seeing this issue, trying to log an object that has the same timestamp in createdAt and updatedAt.

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

4 participants