Error: Exception in addedobserveChanges callback
Hi,
In order to migrate my project to Meteor 3.x, I am now in the process of using zodern:relay to replace peerlibrary:reactive-publish. I do have quite a lot of reactive pipelines, but everything seems to work very well, however in a few occasions I am getting this exception:
I20250217-12:51:12.983(1)? Exception in addedobserveChanges callback: Error: Could not find element with id Wp4NQPdcZAEfctudQ to change
I20250217-12:51:12.984(1)? at SessionCollectionView.changed (packages/ddp-server/livedata_server.js:255:13)
I20250217-12:51:12.984(1)? at Session.changed (packages/ddp-server/livedata_server.js:480:12)
I20250217-12:51:12.984(1)? at Subscription.changed (packages/ddp-server/livedata_server.js:1409:19)
I20250217-12:51:12.984(1)? at added (packages/zodern:relay/pipeline-helpers.ts:152:17)
I20250217-12:51:12.984(1)? at runWithEnvironment (packages/meteor.js:1486:24)
I20250217-12:51:12.984(1)? at packages/meteor.js:1499:14
I20250217-12:51:12.984(1)? at packages/mongo/observe_multiplex.js:178:30
I20250217-12:51:12.984(1)? at Array.forEach (<anonymous>)
I20250217-12:51:12.985(1)? at Function._.each._.forEach (packages/underscore.js:139:11)
I20250217-12:51:12.985(1)? at Object.task (packages/mongo/observe_multiplex.js:172:9)
I20250217-12:51:12.985(1)? at Meteor._SynchronousQueue.SQp._run (packages/meteor.js:1026:16)
I20250217-12:51:12.985(1)? at packages/meteor.js:1003:12``
I have a feeling that this happens when a result of a cursor in an earlier pipeline changes while a later pipeline is still running. I am not able to exactly find out the cause though... any ideas?
I am still using Meteor 2.16.
FYI, I still get a similar error with Meteor 3.1.2:
I20250310-10:23:02.087(1)? Exception from task Error: Could not find element with id rxQ6ZdcB6TfCGzaQd to change
I20250310-10:23:02.088(1)? at SessionCollectionView.changed (packages/ddp-server/session_collection_view.ts:103:13)
I20250310-10:23:02.088(1)? at Session.changed (packages/ddp-server/livedata_server.js:265:12)
I20250310-10:23:02.088(1)? at Subscription.changed (packages/ddp-server/livedata_server.js:1191:19)
I20250310-10:23:02.088(1)? at added (packages/zodern:relay/pipeline-helpers.ts:167:17)
I20250310-10:23:02.088(1)? at packages/mongo/observe_multiplex.ts:161:46
I20250310-10:23:02.088(1)? at runNextTicks (node:internal/process/task_queues:65:5)
I20250310-10:23:02.088(1)? at processImmediate (node:internal/timers:459:9)
I20250310-10:23:02.088(1)? at process.topLevelDomainCallback (node:domain:161:15)
I20250310-10:23:02.088(1)? at process.callbackTrampoline (node:internal/async_hooks:128:24)
I20250310-10:23:02.089(1)? at AsynchronousQueue._processOrderedBatch (packages/meteor.js:915:24)
I20250310-10:23:02.089(1)? at AsynchronousQueue._run (packages/meteor.js:873:7)
I20250310-10:23:02.089(1)? Exception in queued task Error: Could not find element with id rxQ6ZdcB6TfCGzaQd to change
I20250310-10:23:02.089(1)? at SessionCollectionView.changed (packages/ddp-server/session_collection_view.ts:103:13)
I20250310-10:23:02.089(1)? at Session.changed (packages/ddp-server/livedata_server.js:265:12)
I20250310-10:23:02.089(1)? at Subscription.changed (packages/ddp-server/livedata_server.js:1191:19)
I20250310-10:23:02.090(1)? at added (packages/zodern:relay/pipeline-helpers.ts:167:17)
I20250310-10:23:02.090(1)? at packages/mongo/observe_multiplex.ts:161:46
I20250310-10:23:02.090(1)? at runNextTicks (node:internal/process/task_queues:65:5)
I20250310-10:23:02.090(1)? at processImmediate (node:internal/timers:459:9)
I20250310-10:23:02.090(1)? at process.topLevelDomainCallback (node:domain:161:15)
I20250310-10:23:02.090(1)? at process.callbackTrampoline (node:internal/async_hooks:128:24)
I20250310-10:23:02.090(1)? at AsynchronousQueue._processOrderedBatch (packages/meteor.js:915:24)
I20250310-10:23:02.090(1)? at AsynchronousQueue._run (packages/meteor.js:873:7)
The weird thing is that the document with id rxQ6ZdcB6TfCGzaQd does exist. Could this be a Meteor issue?
Update: by altering the update order of some collections I can avoid the above errors.
(Still leaves me with issue#23 where I don't have a workaround for yet)