firebase-js-sdk
firebase-js-sdk copied to clipboard
console.log "heartbeats" is unnecessary
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,
});
Appears to have been introduced with #8425
Can confirm that after updating to "firebase": "^10.13.0", i now end up getting:
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'
}
]
Same problem.
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.
Experiencing the same issue when I just updgraded to "firebase": "^10.13.0".
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.
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.logis released next Thursday.
~~10.12.5~~ 10.12.4
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.logis 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 https://github.com/firebase/firebase-js-sdk/pull/8426
Are you seeing this in 10.12.4?
No, but I see it in 10.12.5
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.
@dlarocque Apologies, I must've been mistaken. Indeed, 10.12.5 does NOT display the "heartbeats" logs.
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);
This was removed in https://github.com/firebase/firebase-js-sdk/pull/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
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.
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);
};`
This is super annoying. How can this happen?
doesn't eslint caches this kind of things? how did it pass the CI? (asking for next time)
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
The fix for this was released in 10.13.1 today.
Great Success