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

User subscribes, but seems to be not logged in on the server #413

Closed
dnish opened this issue Dec 6, 2024 · 1 comment
Closed

User subscribes, but seems to be not logged in on the server #413

dnish opened this issue Dec 6, 2024 · 1 comment

Comments

@dnish
Copy link

dnish commented Dec 6, 2024

Hey,
after upgrading to Meteor v3, we noticed an error when some users try to subscribe to a Vent publisher. Our code looks like this:

Client:

 this.vent = Vent.subscribe('messages', {userId: this.userId});

Server:

Vent.publish('messages', function({userId}) {

    if(this.userId && userId === this.userId) {

        this.on(`messages::${userId}::new`, ({message}) => {
            return {message};
        });

    }else {
        console.error(`Wanted user id: ${userId}, but logged in is ${this.userId}`)
        return this.ready();
    }


});

The console.error fires often in production, telling that the wanted user id was XYZ, but logged in was null. I also noticed in from time to time during development, but I was logged in the whole time. We call Vent.subscribe only then, when Meteor.userId() is available on the client. I've also tried to remove other packages like fast-render to see if they cause that issue, but even without fast-render, we receive this messages. In Meteor v2, our logs were empty.

Copy link

github-actions bot commented Dec 6, 2024

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee you issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.

Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know

@dnish dnish closed this as completed Dec 7, 2024
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

1 participant