404 when requesting the /api/v1/live endpoint on Talk


#1

For some reason the live endpoint is returning 404 on our setup, and I was wondering why that might be happening / what we’re doing wrong. We are on the 4.3 release of Talk, but it happened on the 4.2.2 version as well. We are running cli-serve with -w, and when I set the debug level to info, I get the ‘Websocket server started’ message.

On my development machine, I don’t have any problems, it connects fine.

Here are the startup logs:
talk_1 | 2018-03-29T22:58:10.487915000Z $ ./bin/cli-serve -j -w
talk_1 | 2018-03-29T22:58:12.736330000Z 2018-03-29T22:58:12.734Z talk:graph:subscriptions path: /api/v1/live
talk_1 | 2018-03-29T22:58:13.049975000Z 2018-03-29T22:58:13.049Z talk:plugin:notifications registered the talk-plugin-notifications-category-staff plugin for notifications staff,staff
talk_1 | 2018-03-29T22:58:13.050210000Z 2018-03-29T22:58:13.049Z talk:plugin:notifications registered the talk-plugin-notifications-category-reply plugin for notifications reply,reply
talk_1 | 2018-03-29T22:58:13.050400000Z 2018-03-29T22:58:13.050Z talk:plugin:notifications registered the talk-plugin-notifications-category-featured plugin for notifications featured
talk_1 | 2018-03-29T22:58:13.052673000Z 2018-03-29T22:58:13.051Z talk:plugin:notifications registered the talk-plugin-notifications-digest-daily plugin for digest notifications DAILY
talk_1 | 2018-03-29T22:58:13.053029000Z 2018-03-29T22:58:13.052Z talk:plugin:notifications will now notify the [staff, reply] handlers when the ‘commentAdded’ event is emitted
talk_1 | 2018-03-29T22:58:13.053341000Z 2018-03-29T22:58:13.052Z talk:plugin:notifications will now notify the [staff, reply] handlers when the ‘commentAccepted’ event is emitted
talk_1 | 2018-03-29T22:58:13.053675000Z 2018-03-29T22:58:13.052Z talk:plugin:notifications will now notify the [featured] handlers when the ‘commentFeatured’ event is emitted
talk_1 | 2018-03-29T22:58:13.132412000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs”,“level”:30,“msg”:“Setup is not currently available, migrations now bein
g checked”,“time”:“2018-03-29T22:58:13.130Z”,“src”:{“file”:"/usr/src/app/serve.js",“line”:103,“func”:“serve”},“v”:0}
talk_1 | 2018-03-29T22:58:13.142972000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs”,“level”:30,“msg”:“Migrations do not have to be run”,“time”:“2018-03-29T
22:58:13.142Z”,“src”:{“file”:"/usr/src/app/serve.js",“line”:123,“func”:“serve”},“v”:0}
talk_1 | 2018-03-29T22:58:13.146943000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs”,“level”:30,“taskName”:“mailer”,“msg”:“Starting job”,“time”:“2018-03-29T
22:58:13.146Z”,“src”:{“file”:"/usr/src/app/jobs/index.js",“line”:15,“func”:“Object.entries.forEach”},“v”:0}
talk_1 | 2018-03-29T22:58:13.149120000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs:mailer”,“level”:30,“taskName”:“mailer”,“msg”:“Now processing jobs”,“time
“:“2018-03-29T22:58:13.148Z”,“src”:{“file”:”/usr/src/app/jobs/mailer.js”,“line”:145,“func”:“module.exports”},“v”:0}
talk_1 | 2018-03-29T22:58:13.155074000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs”,“level”:30,“taskName”:“scraper”,“msg”:“Starting job”,“time”:“2018-03-29
T22:58:13.154Z”,“src”:{“file”:"/usr/src/app/jobs/index.js",“line”:15,“func”:“Object.entries.forEach”},“v”:0}
talk_1 | 2018-03-29T22:58:13.155618000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs:scraper”,“level”:30,“taskName”:“scraper”,“msg”:“Now processing jobs”,“ti
me”:“2018-03-29T22:58:13.155Z”,“src”:{“file”:"/usr/src/app/jobs/scraper.js",“line”:43,“func”:“module.exports”},“v”:0}
talk_1 | 2018-03-29T22:58:13.156845000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs”,“level”:30,“port”:5000,“msg”:“API server started”,“time”:“2018-03-29T22
:58:13.156Z”,“src”:{“file”:"/usr/src/app/serve.js",“line”:74,“func”:“onListening”},“v”:0}
talk_1 | 2018-03-29T22:58:13.157336000Z {“name”:“talk”,“version”:“4.3.0”,“revision”:"",“hostname”:“c5e8783c91b8”,“pid”:27,“origin”:“jobs”,“level”:30,“port”:5000,“msg”:“Websocket server started”,“time”:“2018-03
-29T22:58:13.156Z”,“src”:{“file”:"/usr/src/app/serve.js",“line”:135,“func”:“server.listen”},“v”:0}
talk_1 | 2018-03-29T22:58:13.160013000Z subscriptionManager is deprecated, use execute or subscribe directly from graphql-js!
talk_1 | 2018-03-29T22:58:13.215708000Z GET /api/v1/live 404 32.444 ms - 121

I’m sort of out of ideas. Has anyone seen this before? Any tips on where to look next?

Thanks,
Kit


#2

Hey Kit are you sure the url is included in your Permitted Domains in your settings?


#3

Yeah, it’s in my permitted domains. The functionality is all there actually, the issue is only with the live endpoint. Everything else appears fine, comments work as expected.


#4

I figured it out with the help of this blog post:

My reverse proxy wasn’t correctly doing the connection upgrading for the websockets:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;

After adding that for the live endpoint, it works correctly!

Thanks,
Kit


#5

Oh good! Let us know if you go live with Talk, and if we can help with anything in the meantime. We also have a piece of things to think about before going live:

https://docs.coralproject.net/talk/when-youve-installed-talk/