This repository was archived by the owner on Sep 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
commonMessageHandler returning null #32
Copy link
Copy link
Open
Description
Hi there,
My luck that this is not maintained anymore.... :/
If anyone would be able to assist it would be great:
//subscribing to this endpoint:
subscription Subscription {
organizationsChanged {
id
}
}
results in organizationsChanged to be null:
// Response received at 23:24:00
{
"data": {
"organizationsChanged": null
}
}
// Response received at 23:23:59
{
"data": {
"organizationsChanged": null
}
}
// Response received at 23:23:58
{
"data": {
"organizationsChanged": null
}
}
Project setup is as follows:
//schema.ts
type Subscription {
organizationsChanged: testObject
}
type testObject {
id: String
}
//resolver
Subscription: {
// get all tracks, will be used to populate the homepage grid of our web client
organizationsChanged: {
subscribe: () => pubsub.asyncIterator(["ORGANISATION_CHANGED2"]),
},
},
//init
import { GooglePubSub } from '@axelspringer/graphql-google-pubsub';
// SETUP subscriptions
function commonMessageHandler (payload:any) {
console.log(payload.id); /// get the correct data from publish here - whohoo!
return {
id: payload.id
}
}
const pubsub = new GooglePubSub({
projectId: 'PROJECT_ID',
credentials:{
client_email: 'SERV_ACC_EMAIL,
private_key: "THE_KEY"
}
}, topicName => `ORGANISATION_CHANGED2`, commonMessageHandler)
}
//package.json
"dependencies": {
"@axelspringer/graphql-google-pubsub": "^2.1.0",
"apollo-datasource-rest": "^0.14.0",
"apollo-server": "2.19.1",
"dataloader": "^2.0.0",
"graphql": "15.4.0"
},
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels