openBatchChannel failing
I've got some code I've been using for ages that's been working until my upgrade to 3.8.4 (had been several years since I'd updated). Now, any attempt to work with batch session data is failing. My console looks like this:
jatos.js:580 WebSocket connection to 'wss://starklab.bio.uci.edu/publix/d64e7485-543a-4bd6-b513-384780e2d38a/batch/open' failed: openBatchChannel @ jatos.js:580 jatos.js:593 Batch channel error batchChannel.onerror @ jatos.js:593 start:70 In consent, sid= 99999 start:75 2023-9-6-12-26 start:78 no record yet, adding one at /99999 jatos.js:2870 Can't send batch session patch. No open batch channel (anonymous) @ jatos.js:2870 start:81 1 Batch Session synchronization failed jatos.js:580 WebSocket connection to 'wss://starklab.bio.uci.edu/publix/d64e7485-543a-4bd6-b513-384780e2d38a/batch/open' failed: openBatchChannel @ jatos.js:580 jatos.js:593 Batch channel error batchChannel.onerror @ jatos.js:593 jatos.js:580 WebSocket connection to 'wss://starklab.bio.uci.edu/publix/d64e7485-543a-4bd6-b513-384780e2d38a/batch/open' failed: openBatchChannel @ jatos.js:580 openBatchChannelWithRetry @ jatos.js:541 (anonymous) @ jatos.js:544 jatos.js:593 Batch channel error batchChannel.onerror @ jatos.js:593 error (async) openBatchChannel @ jatos.js:592 openBatchChannelWithRetry @ jatos.js:541 (anonymous) @ jatos.js:544 jatos.js:580 WebSocket connection to 'wss://starklab.bio.uci.edu/publix/d64e7485-543a-4bd6-b513-384780e2d38a/batch/open' failed: openBatchChannel @ jatos.js:580 openBatchChannelWithRetry @ jatos.js:541 (anonymous) @ jatos.js:544 jatos.js:593 Batch channel error
The task in question is a super-simple one -- just an HTML consent form (attached).
This seems to happen immediately. The console.log('In consent...') bit comes up after the first errors get logged and at that point, I've not even called anything with batchSession.
Any thoughts as to what may be going on here?
Craig
Comments
Hi Craig,
Do you have access to JATOS' administration page (only JATOS admins have)? It's under http://my-IP-or-domain/jatos/admin. Can you click the Tests button and check that all tests show an 'OK'. Especially the WebSocket one is important for the batch channel.
Best,
Kristian
All come up green / OK
Correct URL host: OK
Connect to database: OK
Access to study assets root folder: OK
Access to result uploads folder: OK
Access to logs folder: OK
Access to study logs folder: OK
Access to tmp folder: OK
Read jatos.js (via study path): OK
Read jatos.js (via assets path): OK
Open WebSocket: OK
That looks good.
In your log messages this one means that the browser cannot establish a WebSocket connection to your server during a study run:
What makes it a bit weird is that the WebSocket test shows an 'OK'.
But maybe you have an reverse proxy like Nginx or Apache in front of JATOS and the somehow the WebSocket rewrites/locations are faulty. Can you check? The JATOS docs have some example configs for Nginx and Apache.
And another question: from which version did you update your JATOS?
Best,
K
I upgraded from 3.6.1 and yes, I'm using nginx and have checked those links a bit in setting things up. I admit, however, that I'm either a total idiot or an absent-minded professor who studies memory, aging, and the decline of memory for details and events with aging. I'm putting this reply in for both public shaming and to help anyone else who might hit the issue. Here's a bit from my
/etc/nginx/nginx.conf
file:See that nice difference between what I'd made a note for myself a few months back to handle when I did the upgrade to do (based on your nice docs) and what was still in there after the upgrade? See how it's specifically directed at the web sockets? Sigh... So, yeah, putting that bit in and restarting the servers has the issue go away. PEBKAC
Craig
Hi Craig!
Nice you found the error and thanks for posting your results!
Best
Kristian