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

console.log "heartbeats" is unnecessary #8436

Closed
tzappia opened this issue Aug 17, 2024 · 21 comments
Closed

console.log "heartbeats" is unnecessary #8436

tzappia opened this issue Aug 17, 2024 · 21 comments

Comments

@tzappia
Copy link

tzappia commented Aug 17, 2024

Operating System

macOS 14.6.1

Browser Version

Chrome/127.0.6533.120

Firebase SDK Version

10.13.0

Firebase SDK Product:

Auth, Firestore, Functions, Storage

Describe your project's tooling

Angular v18 app

Describe the problem

During initialization, an unhelpful console.log is repeated:

heartbeats undefined

Steps and code to reproduce issue

After initializing the app, initialize Firestore (for example)

    this.app = initializeApp({
      apiKey: environment.firebase.apiKey,
      authDomain: environment.firebase.authDomain,
      databaseURL: environment.firebase.databaseURL,
      projectId: environment.firebase.projectId,
      storageBucket: environment.firebase.storageBucket,
      messagingSenderId: environment.firebase.messagingSenderId,
      appId: environment.firebase.appId,
    });

    this.db = initializeFirestore(this.app, {
      ignoreUndefinedProperties: true,
    });
@tzappia tzappia added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Aug 17, 2024
@tzappia
Copy link
Author

tzappia commented Aug 17, 2024

Appears to have been introduced with #8425

@BastianBrouwers
Copy link

Can confirm that after updating to "firebase": "^10.13.0", i now end up getting:

image

@NickFoden
Copy link

Same, but in a react app and it's super noisy in the logs and in local dev.

heartbeats [
  {
    date: '2024-08-18',
    agent: 'fire-core/0.10.9 fire-core-esm2017/0.10.9 fire-js/ fire-js-all-app/10.13.0 fire-gcs/0.13.0 fire-fn-node/0.11.6 fire-fn-esm2017/0.11.6 fire-auth-node/1.7.7 fire-auth-esm2017/1.7.7 fire-rtdb-node/1.0.7 fire-rtdb-esm2017/1.0.7 fire-fst-node/4.7.0 fire-fst-esm2017/4.7.0 fire-iid/0.6.8 fire-iid-esm2017/0.6.8 fire-analytics/0.10.7 fire-analytics-esm2017/0.10.7'
  }
]

@hqw567
Copy link

hqw567 commented Aug 19, 2024

Same problem.

@jbalidiong jbalidiong added needs-attention and removed new A new issue that hasn't be categoirzed as question, bug or feature request labels Aug 19, 2024
@jbalidiong
Copy link
Contributor

Hi @tzappia, thank for bringing this to our attention. I was able to reproduce the behavior. Let me check what we can do for this issue or bring someone here that can provide more context about it. I’ll update this thread if I have any information to share.

@jeffgaynor
Copy link

Experiencing the same issue when I just updgraded to "firebase": "^10.13.0".

@dlarocque
Copy link
Contributor

Thanks for reporting this!

This was introduced in 10.13.0, so if anyone wants to get rid of this they can downgrade to 10.12.5 until the removal of the console.log is released next Thursday.

@ben519
Copy link

ben519 commented Aug 19, 2024

This was introduced in 10.13.0, so if anyone wants to get rid of this they can downgrade to 10.12.5 until the removal of the console.log is released next Thursday.

10.12.5 10.12.4

@dlarocque
Copy link
Contributor

This was introduced in 10.13.0, so if anyone wants to get rid of this they can downgrade to 10.12.5 until the removal of the console.log is released next Thursday.

10.12.5 10.12.4

Are you seeing this in 10.12.4? The PR was merged into the 10.13 release here #8426

@ben519
Copy link

ben519 commented Aug 19, 2024

Are you seeing this in 10.12.4?

No, but I see it in 10.12.5

@dlarocque
Copy link
Contributor

dlarocque commented Aug 19, 2024

Are you seeing this in 10.12.4?

No, but I see it in 10.12.5

Sorry, I meant 10.12.5.

I just tested this, and I am seeing it in 10.13.0, but not 10.12.5. Could you share what version of @firebase/app you have installed?

Looking at https://www.gstatic.com/firebasejs/10.13.0/firebase-app.js there is a console.log('heartbeats', (_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats);, but in https://www.gstatic.com/firebasejs/10.12.5/firebase-app.js there isn't.

@ben519
Copy link

ben519 commented Aug 19, 2024

@dlarocque Apologies, I must've been mistaken. Indeed, 10.12.5 does NOT display the "heartbeats" logs.

@saifbechan
Copy link

saifbechan commented Aug 19, 2024

Seeing this as well in version 10.13.0. We are using this in a nextjs app and I am seeing the message both on server side and client side.

heartbeats undefined

Coming from these lines:

export const auth = getAuth(app);

export const db = getFirestore(app);

@dlarocque
Copy link
Contributor

dlarocque commented Aug 19, 2024

This was removed in #8437, which will be released next thursday (08/29). I'll keep this issue open until it's released. Thanks everyone for +1'ing this

@nickredmark
Copy link

a tip: we have an eslint rule that errors on console.log so that it forces temporary usage. for permanent logs we use console.info/warn/error.

@Xaypanya
Copy link

This is a temporary workaround. Insert this snippet at the beginning of your main JavaScript file (e.g., index.js, main.js, etc.) or wherever you initialize Firebase:


// Save the original console.log function
const originalConsoleLog = console.log;

console.log = function(...args) {
// Check if the log message contains the word "heartbeats"
if (args.some(arg => typeof arg === 'string' && arg.includes('heartbeats'))) {
return; // Skip the log message
}

// Otherwise, use the original console.log
originalConsoleLog.apply(console, args);
};`

@flomoto
Copy link

flomoto commented Aug 25, 2024

This is super annoying. How can this happen?

@erlichmen
Copy link

doesn't eslint caches this kind of things? how did it pass the CI? (asking for next time)

@RicardoESH
Copy link

Great! I'm looking forward to the update

This was removed in #8437, which will be released next thursday (08/29). I'll keep this issue open until it's released. Thanks everyone for +1'ing this

@dlarocque
Copy link
Contributor

The fix for this was released in 10.13.1 today.

@Kronenberg
Copy link

Great Success

@firebase firebase locked and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests