Hi Devs,
The above issue repeated today, when a user opened Redactor, uploaded an image and tried to post the message.
Redactor failed and the only way to recover it was to close it and re-open.
With some debugging I was able to identify two issues:
- Postgress driver - looking at postgress logs, note the following:
2018-12-26 13:07:28 UTC:172-15-10-85.lightspeed.snjsca.sbcglobal.net(33758):[9559]:ERROR: payload string too long
2018-12-26 13:07:28 UTC:172-15-10-85.lightspeed.snjsca.sbcglobal.net(33758):[9559]:STATEMENT: SELECT pg_notify('socketio', $1::TEXT)
2018-12-26 13:07:28 UTC:172-15-10-85.lightspeed.snjsca.sbcglobal.net(33754):[9557]:ERROR: payload string too long
2018-12-26 13:07:28 UTC:172-15-10-85.lightspeed.snjsca.sbcglobal.net(33754):[9557]:STATEMENT: SELECT pg_notify('socketio', $1::TEXT)
SELECT pg_notify('socketio', $1::TEXT) is likely sourced from node_modules/socket.io-adapter-postgres/index.js, line 118.
It seems that the driver may have an error related to session hash strings. The postgress has a hard stop at 8000 characters and it might be that the hash string is too big. I don't know much about postgres so this is as far as I can debug.
It seems however that the entire code was re-written in the pull request by @Ben-Lubar here:
https://github.com/NodeBB/NodeBB/pull/6745
Is it possible to merge the code revision into the main branch?
- Redactor:
Currently, upon file load failure, redactor fails and does not recover.
That's easy to reproduce - just add a hook with
{ "hook": "filter:uploadFile", "method": "myUploadFile", "priority": 6 }
In myUploadFile just return an error for example:
return calback(Error('myError'));
Redactor fails in line 10697 here:
xhr.send(formData);
Since errors are not handled , JS stops dead on the spot. Furthermore, the user does not get any indication of the error, although the xhr packet does contain an error string. With that, the only way to recover is to close the editor and re-open it.
These two issues are independent. The fix in Redactor is simple I believe (handling the error, toasting a message). As for PG, I hope the new code incorporates a fix.
Kindly let me know should you need further information,
Longterm, I hope quill will replace Redactor. There's not a lot of things left to do to make https://github.com/NodeBB/nodebb-plugin-composer-quill/ production ready. But I totally realize @Julian is extremely busy.
JJ.