Accounts.onLogin keep firing every few seconds on Production

Need some guidelines how to solve this on production.

We define Accounts.onLogin as per below, it worked normally on localhost, but when push to production, the onLogin function keep on firing every 10± seconds.

Accounts.onLogin(() => {
	const redirect = Session.get('redirectAfterLogin')

	if (Meteor.user()) {
		const user = Meteor.user(),
			settings = user.profile.settings,
			language = settings.language,
			country =,
			currency = settings.currency,
			company =

		if (!Session.get('id')) { Session.set('id', user._id) }
		if (!Session.get('company')) { Session.set('company', company) }
		if (!Session.get('language')) { Session.set('language', language) }
		if (!Session.get('country')) { Session.set('country', country) }
		if (!Session.get('currency')) { Session.set('currency', currency) }

	if (!!redirect && redirect !== '/account/sign-in') { FlowRouter.go(redirect) }

	console.log('onLogin triggered')

Do you see any errors in your console? This might happen because your loadbalancer disconnects the user every 10 seconds. What infrastructure are you running on? I had similar issues when running Meteor in Kubernetes for example

console doesn’t have any errors beside counting "onLogin triggered"

our application deployed to Google Cloud Compute Engine (GCCE) using Ubuntu 18, MongoDB was deployed to MongoDB Atlas, and we use Google Load Balancer to route domain name to GCCE

Meteor v1.8, MongoDB v3.6

Do you have the Meteor dev tools? Is it re-subscribing the collections every 10 seconds too? If that’s the case it’s almost for sure a loadbalancer issue.