Meteor.logout() not working

I’m having an intermittant problem where Meteor.logout() doesn’t do anything. Meteor.UserID() continues to report that I’m logged in.

I have a single page app, and I didn’t bother with flow router because it seems unnecessary. However, I want to use okgrow/analytics package, which requires flow router. I have added it, and removed it, and experienced the failure to logout in both circumstances.

I haven’t configured any routes.

Project is here:

In this code block:

'click .logout': function(){
		console.log('logging out'); 
		Meteor.logout(function(){ 
			Modal.show('loginModal');
		});
	},

does it output “logging out” to the console in developer tools? If not then you can try this:

'click .logout': function(e){
e.preventDefault();
		console.log('logging out'); 
		Meteor.logout(function(){ 
			Modal.show('loginModal');
		});
	},

I have tried that, and I do see the console.log() output.

But even going directly into the console and typing

Meteor.logout()

Doesn’t do anything. I’m so confused! Is it something to do with the packages I’ve installed?

Here are those packages


meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.14                   # The database Meteor supports right now
blaze-html-templates@1.0.4    # Compile .html files into Meteor Blaze views
reactive-var@1.0.11            # Reactive variable for tracker
jquery@1.11.10                  # Helpful client-side library
tracker@1.1.1                 # Meteor's client-side reactive programming library

standard-minifier-css@1.3.2   # CSS minifier run for production mode
standard-minifier-js@1.2.1    # JS minifier run for production mode
es5-shim@4.6.15                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.5.9              # Enable ECMAScript2015+ syntax in app code
shell-server@0.2.1            # Server-side component of the `meteor shell` command

mrt:cheerio
aldeed:simple-schema
aldeed:collection2
aldeed:tabular
session@1.1.7
twbs:bootstrap
froatsnook:request
gfk:notifications
peppelg:bootstrap-3-modal
accounts-ui@1.1.9
useraccounts:bootstrap
gwendall:auth-client-callbacks
simple:rest
tarang:ssl
gfk:server-messages
okgrow:analytics
accounts-password
kadira:blaze-layout

Hello,

Maybe it’s something else. I remember on day. Have a bad effect about the logout.

The wrong code was something like a infinity loop of setTimeout with http post and meteor.call.

1 Like

I think you are implying that some other code is blocking meter calls? How do I… find it?

I really am having a bit of a nightmare with this one. If anyone can suggest either a likely culprit or a debug strategy then I’d be eternally grateful.

1 Like

Have you tried

Meteor.logout(function(err){ 
  console.log(err);
});

In case something useful is being reported?

Edit: Just to add to this, I see you are using a useraccounts package. I have a feeling that may use a different logout method (never used any of those packages, so I can’t be too sure).

Fantastic, I will try looking at the error.

Have I ended up using something esoteric unintentionally?

I just wanted to be able to show a login form in a modal window, and also have a logout button!

Perhaps it’s because I don’t have this:

https://atmospherejs.com/useraccounts/core

https://meteorhacks.com/discover-meteor-ddp-in-realtime/

And you can try a meteor reset plus rm -rf .meteor/local

Yep - ddp was getting blocked by a very long running process on the server, and it just so happened that I noticed it with the log out button first.

Thanks for your help on this.