axelspringer/graphql-google-pubsub

Subscription return [object][object] in graphiql

Closed this issue · 2 comments

Hi guys, it's a great implementation here for the google pubsub
However, I got into a trouble to setup this.
Here are my codes
import { GooglePubSub } from '@axelspringer/graphql-google-pubsub'; const options = { projectName: PROJECT_NAME } const pubsub = new GooglePubSub(options)
When I tested with graphql-subscription pubsub, everything is fine
But with this library, I'm not sure how to debug it
Here I logged in the main library , and the data is correct, but in graphiql subscription, it was [object][object]
`GooglePubSub.prototype.publish = function (topicName, data, attributes) {
if (typeof data !== 'string') {
data = JSON.stringify(data);
}
console.log('data', data);

    return this.pubSubClient
        .topic(topicName)
        .publisher()
        .publish(Buffer.from(data), attributes);
};`

Sorry for not including my full code
Thanks in advance

Hey @petixiuxx,
if GraphiQL displays [object][object] it usually means that you got an error as subscription result.
You can investigate the websocket frames via Chrome DevTools to get more info about the error:
https://kaazing.com/inspecting-websocket-traffic-with-chrome-developer-tools/
Do you see any error in the api logs?
Maybe the authentication to Google PubSub doesn't work but it's hard to say without any error details.

Thanks for your help. It was very weird when I tried to debug, I got a subscription message on google cloud pubsub, but nothing came to my client website (after checking the ws in chrome dev tool)
It would be very helpful if you include an working example for implementation.
Many thanks to you 💯 👍 😄