Production only error related to redis-oplog and meteor 3

Hi all,

tried to finally update from meteor 2.1.6 to 3.0.4 in my production environment but came across an error which is hard to reproduce for me and ultimately made me roll back the update.

I use the latest beta of redis-oplog. While running a certain server method, the progress of that method gets upserted in a db doc and published to the user, in order to inform about the methods progress. However, these updates are not published to the client; I have the following logs:

2024-12-04 13:05:57.004172135 +0100 CET [web-1] Meteor.userId can only be invoked in method calls or publications.
2024-12-04 13:05:57.004177553 +0100 CET [web-1] at AccountsServer.userId (packages/accounts-base/accounts_server.js:124:13)
2024-12-04 13:05:57.004360738 +0100 CET [web-1] at RedisSubscriptionManager.process (packages/cultofcoders:redis-oplog/lib/redis/RedisSubscriptionManager.js:142:26)
2024-12-04 13:05:57.004266553 +0100 CET [web-1] at Object.Meteor.userAsync (packages/accounts-base/accounts_common.js:463:40)
2024-12-04 13:05:57.005543021 +0100 CET [web-1] at packages/cultofcoders:redis-oplog/lib/redis/RedisSubscriptionManager.js:82:20
2024-12-04 13:05:57.004366412 +0100 CET [web-1] at Immediate.<anonymous> (packages/meteor.js:873:12)
2024-12-04 13:05:57.004365847 +0100 CET [web-1] at AsynchronousQueue._run (packages/meteor.js:892:24)
2024-12-04 13:05:57.004268101 +0100 CET [web-1] at RedisSubscriptionManager.getDoc (packages/cultofcoders:redis-oplog/lib/redis/RedisSubscriptionManager.js:203:30)
2024-12-04 13:05:57.005544236 +0100 CET [web-1] at AsyncLocalStorage.run (node:async_hooks:346:14)

Strange enough, this doesn’t appear in my dev environment. Also, other publications are working fine. Once I remove redis-oplog, the issue also disappears.

I find it really hard to debug, the stack trace doesn’t really point to anything useful.

Do you (maybe @storyteller ) have a hint on where to look at or how to debug further?

Ok got some additional context now; the problem can be reproduced in dev if I use a separate worker instance. The worker updates the progress status. In the web-instance, I get the above errors.

Can you share a code sample or a reproduction? It’s difficult to assess without seeing a sample code

Yes, I see. I’ve set up a minimal repo using bullmq for the queue-worker setup and redis oplog. However here the issue doesn’t occur, although the mechanics are quite similar to those in my production app. Hence, the issue must be some speciality in my code which I didn’t figure out yet. Will try to investigate further.