axelspringer / graphql-google-pubsub

A graphql-subscriptions PubSub Engine using Google PubSub
MIT License
136 stars 43 forks source link

Possible bug in pubsub.asyncIterator() #6

Open stevesuh opened 6 years ago

stevesuh commented 6 years ago
[Node] uncaughtException Error: Failed to create subchannel
[Node]     at Immediate.onConnectionStatus (/Users/ssuh/axio/insurance-storage/node_modules/@google-cloud/pubsub/src/connection-pool.js:293:21)
[Node]     at runCallback (timers.js:697:11)
[Node]     at tryOnImmediate (timers.js:667:5)
[Node]     at processImmediate (timers.js:649:5)

I was logging this line. https://github.com/axelspringer/graphql-google-pubsub/blob/master/src/google-pubsub.ts#L81

I saw one message go through from the async iterator but then the it blew up on second one. So there should at least be a try catch.

TimSusa commented 5 years ago

We should consider to make the code more resilient here.

TimSusa commented 5 years ago

Another possible problem could be here, that the message is acked before handleMessage. Is that really the way to go, or should ack better be called after handleMessage?