After upgrading to Meteor 2.3, with no other changes made, my calls to PostgresPubSub.pubsub
have stopped working.
import {PostgresPubSub} from 'graphql-postgres-subscriptions';
const pubsub = new PostgresPubSub({
// setup options
});
[.....]
Calling pubsub.publish()
no longer results in a call to my subscription filter function. E.g. calling this in an Apollo mutation resolver:
pubsub.publish(IM_ADDED_CHANNEL, {
InstantMessage_Subscription
});
…no longer results in a call to this:
InstantMessage_Subscription: {
subscribe: withFilter(
() => {
console.log(`subscribed to InstantMessage_Subscription by ${Meteor.userId()}`);
return pubsub.asyncIterator(IM_ADDED_CHANNEL)
},
(objectToPublish, args, context) => {
debugger; <== NEVER ACTIVATES
[.....]
)
}
,
Does anyone have pubsub working with Apollo after updating to Meteor 2.3?
Solved.
Possibly it had something to with the node upgrade. The code I was using to set up pubsub:
import {PostgresPubSub} from 'graphql-postgres-subscriptions';
const pubsub = new PostgresPubSub({
user: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].dbuser,
host: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].host,
database: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].dbname,
password: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].dbpsd,
port: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].port,
});
…stopped working for some reason. I updated to:
import {PostgresPubSub} from 'graphql-postgres-subscriptions';
import { Client } from "pg"
const client = new Client({
user: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].dbuser,
host: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].host,
database: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].dbname,
password: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].dbpsd,
port: Meteor.settings.postgres[Meteor.isDevelopment ? 'development' : 'production'].port,
})
client.connect();
const pubsub = new PostgresPubSub({ client });
…and, pubsub is working again.