Skip to content

Meteor 3: Error: Meteor.userId can only be invoked in method calls or publications with Meteor.bindEnvironment #13258

@aboire

Description

@aboire

Hello,

I am encountering an issue while updating an application from Meteor 2 to Meteor 3. In my application, I use Meteor.userId() within helpers and other functions wrapped with Meteor.bindEnvironment.

Under Meteor 2, everything worked correctly. However, after updating to Meteor 3, I receive the following error when trying to use Meteor.userId() within Meteor.bindEnvironment:

Error: Meteor.userId can only be invoked in method calls or publications.

New Findings

The issue appears in the publish-composite package, where Meteor.bindEnvironment is used in the publication.js file. This usage causes Meteor.userId() to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    idleHave'nt a new comment in the last 3 months

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions