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

After disconnect and reconnect the userId is null in protected #891

Open
aertms opened this issue Aug 21, 2024 · 3 comments
Open

After disconnect and reconnect the userId is null in protected #891

aertms opened this issue Aug 21, 2024 · 3 comments

Comments

@aertms
Copy link

aertms commented Aug 21, 2024

First of all thanks for a great library! I'm having an issue that if the app goes offline for a moment and comes back online (can be simulated with Meteor.disconnect() and Meteor.reconnect() ), the this.userId in the protected method on the server is null. I checked that the x_mtok cookie is set and it's correctly updated to the new session id after the reconnect. I checked in the server.js, in the _getUserDefault() when getting the cookie it gets the old session id for the session that doesn't exist anymore, so it can't find the user. What I would expect is that it returns the new session id so it finds the user. When I refresh the page everything is working again.

I'm using ostrio:files version 2.3.3 on Linux in a single server setup. I created a very simple meteor app to reproduce it here: https://github.com/aertms/mfiles
You can login with user test and password test. If you upload an image file when running the small app it shows below. Now if you run Meteor.disconnect() and then Meteor.reconnect() in the browser console the image is not shown anymore, it returns a 401 code. After a refresh it's shown again.

I'm not sure if this is a bug or if there is an issue with my implementation. Or is this expected and I need to work around it?

@xet7
Copy link

xet7 commented Sep 23, 2024

Is this related to Meteor 3.0.3: Fix Meteor.userId only being invoked with bindEnvironment ?

https://forums.meteor.com/t/meteor-js-v3-0-3-is-out/62251

@aertms
Copy link
Author

aertms commented Sep 24, 2024

I'm still using Meteor 2.16 (sorry, forgot to mention that), so I don't think so. Or might that be a problem in 2.x too?

@xet7
Copy link

xet7 commented Sep 24, 2024

@aertms

At Meteor Forums is also other posts about bug where userId is null. I know only about above userId null fix in Meteor 3. I'm currently in progress of migrating to Meteor 3, I have not tested this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants