[Solved] Internal error calling getPublicationStrategy

Upgraded to 2.4 and I’m getting this error on hard reload, everything works fine but this error is in my server. I have not setup getPublicationStrategy. Is this required now?

I20210920-16:39:41.614(-7)? Exception in addedobserveChanges callback: TypeError: Cannot read property 'getPublicationStrategy' of undefined
I20210920-16:39:41.614(-7)?     at PublishContext.added (packages/ddp-server/livedata_server.js:1330:30)
I20210920-16:39:41.615(-7)?     at PublishContext.publish.added (packages/peerlibrary_subscription-scope/server.coffee:19:21)
I20210920-16:39:41.615(-7)?     at added (packages/mongo/collection.js:396:13)
I20210920-16:39:41.615(-7)?     at runWithEnvironment (packages/meteor.js:1320:24)
I20210920-16:39:41.615(-7)?     at packages/meteor.js:1333:14
I20210920-16:39:41.616(-7)?     at packages/mongo/observe_multiplex.js:204:9
I20210920-16:39:41.616(-7)?     at _IdMap.forEach (packages/id-map/id-map.js:46:37)
I20210920-16:39:41.616(-7)?     at ObserveMultiplexer._sendAdds (packages/mongo/observe_multiplex.js:196:22)
I20210920-16:39:41.616(-7)?     at packages/mongo/observe_multiplex.js:50:12
I20210920-16:39:41.616(-7)?     at runWithEnvironment (packages/meteor.js:1320:24)
I20210920-16:39:41.617(-7)?     at Object.task (packages/meteor.js:1333:14)
I20210920-16:39:41.617(-7)?     at Meteor._SynchronousQueue.SQp._run (packages/meteor.js:922:16)
I20210920-16:39:41.617(-7)?     at packages/meteor.js:899:12

Have you tried running meteor update --all-packages ?

@vlasky
I also have this problem and of course all my packages are updated

All packages are updated and I tried a few different projects with same result. I use cult of coders grapher @saeeed , do you?

im using pub/sub system

Hi @flean, no, it’s not required and this error shouldn’t happen.

Could you please open an issue on GitHub?

I believe there is something in https://github.com/peerlibrary/meteor-subscription-scope that is changing the instance and that is resulting in the server attribute to be undefined.

Thanks.

The fix would be simple but I would like to understand why the server is undefined in this flow. This is why a reproduction would be helpful.

@filipenevola I’m on vacation right now so I’ll set it up next Tuesday when I get back. Thanks

Ok, no problem.

If anybody else is getting the same error feel free to open the issue with a reproduction so we can understand the root cause and provide a fix :wink:

@flean and @saeeed
I’ve tried to reproduce this issue using the package peerlibrary_subscription-scope, but I wasn’t able to.
Is there any other package related to publications you guys are using?

Maybe it can give us some clues.

Hi, we need a reproduction.

Could you share a repo and the steps to get this error?

@filipenevola

I did not do anything to cause this error, all I did was update to version 4.

Note I use ssr using the react-router-ssr package

This is my list of packages :

meteor-base@1.5.1             # Packages every Meteor app needs to have
mobile-experience@1.1.0       # Packages for a great mobile UX
mongo@1.13.0                   # The database Meteor supports right now
reactive-var@1.0.11            # Reactive variable for tracker
standard-minifier-js@2.7.0    # JS minifier run for production mode
es5-shim@4.8.0                # ECMAScript 5 compatibility for older browsers
ecmascript@0.15.3              # Enable ECMAScript2015+ syntax in app code
typescript@4.3.5              # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0            # Server-side component of the `meteor shell` command
static-html@1.3.2             # Define static page content in .html files
react-meteor-data       # React higher-order component for reactively tracking Meteor data
npdev:react-loadable
accounts-base@2.1.0
accounts-password@2.1.0
server-render@0.4.0
communitypackages:picker
gadicohen:sitemaps
hot-module-replacement@0.3.0
alanning:roles
dev-error-overlay@0.1.1
ostrio:files
communitypackages:fast-render
juliancwirko:postcss
mizzao:user-status
communitypackages:react-router-ssr

@filipenevola and @renanccastro , I’ve started to narrow it down. It’s related to accounts, if I’m not logged in and hit refresh nothing happens. If I’m logged in and hit refresh on the browser it throws the error. I’ll setup an repo soon.

1 Like

Thank you, this will be really helpful.

I don’t want to just patch the error avoiding using the server because I want to understand in which flow the server is undefined, I don’t think it should be undefined at this point. Maybe this new error is just highlighting an old problem in the code.

1 Like

Any updates with this issue?

Hi, I’m going to check your reproduction today.

Hi @flean are you sure your reproduction is correct?

Because you mentioned that the problem seems to be related to accounts and your repo has no accounts on it. Your reproduction is using METEOR@2.3.6.

Also, the swiper code was producing errors. So I’m not sure if this is the correct reproduction for this problem.

It’s 2.4 , please select the 2.4 branch.