Closed patschi closed 4 years ago
@patschi can you try disabling some of the third-party extensions to see if the issue goes away ?
Another thing that could be helpful, are you able to check the network tab any copy the response data of the last request (I believe it's a POST request to /api/discussions)
The error appears across different users, and no request sent to the server - it fails in the browser before actually sending any data to the server (so no POST request). I believe it's also somehow caused by a other extension, but I have no idea which one.
Enabling/Disabling all extensions is quite time-consuming by this amount of extensions (luckily the site isn't fully live yet). But I guess you're right and that this is the only way narrowing it down further. As I'm pretty new to Flarum and its extensions and I don't know it in-depth, do you have any tips where to start looking?
To find out which extension conflict, I'd suggest:
composer.json
, composer.lock
and a copy of the database (this can be skipped if your site is already a test site)enabled_extensions
in the settings
table. You can use the value to easily re-enable all of them at once later (it's just a list of all the identifiers for the enabled extensions)Alternatively, the backtrace of the error in the console could allow you to find out which extension it was. You can look at each line listed there, and if it's part of the source of an extension it's possible to find which one it is. But it's not user friendly because it requires looking at code that has been compiled.
Actually when reading the thrown JS error:
Uncaught TypeError: Cannot read property 'data' of undefined
at t.getIdentifier (Model.js:303)
at Array.map (<anonymous>)
at e.save (Model.js:142)
at e.s.onsubmit (PrivateDiscussionComposer.js:30)
at e.<anonymous> (removeTags.js:16)
at e.t.<computed> (extend.js:61)
at e.<anonymous> (removeTags.js:16)
at e.t.<computed> (extend.js:61)
at e.<anonymous> (removeTags.js:16)
at e.t.<computed> (extend.js:61)
at e.n.onsubmit (TextEditor.js:182)
at HTMLButtonElement.H.t.<computed> (mithril.js:1286)
The error is thrown in the core Model.js
library. None of the listed .js files comes from a 3rd-party-extension.
However I've disabled extensions which might influence the behavior of the page when viewing a user page - but still occurring. I disabled these: FoF Spamblock, FoF Social Profile, FoF Moderator Notes, ReFlar Level Ranks, Suspend, Color Codes, Terms.
I have the same issue on a fresh flarum install. I tried to downgrade the core to beta.11 but no luck, the error is still there.
TypeError: t is undefined Model.js:303:6
getIdentifier Model.js:303
map self-hosted:251
save Model.js:142
onsubmit PrivateDiscussionComposer.js:30
<anonymous> self-hosted:874
It removeTags.js:16
e extend.js:61
<anonymous> self-hosted:874
It removeTags.js:16
e extend.js:61
<anonymous> self-hosted:874
It removeTags.js:16
e extend.js:61
<anonymous> self-hosted:876
onsubmit TextEditor.js:182
<anonymous> self-hosted:876
H/t[e]< mithril.js:1286
Flarum core 0.1.0-beta.12
PHP version: 7.3.11
Loaded extensions: Core, phpdbg_webhelper, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, fileinfo, filter, ftp, gd, gettext, gmp, SPL, iconv, intl, json, ldap, mbstring, session, standard, odbc, pcntl, mysqlnd, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, Reflection, mysqli, shmop, SimpleXML, soap, sockets, sodium, exif, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache
+----------------------+----------------+--------+
| Flarum Extensions | | |
+----------------------+----------------+--------+
| ID | Version | Commit |
+----------------------+----------------+--------+
| flarum-approval | v0.1.0-beta.12 | |
| flarum-bbcode | v0.1.0-beta.12 | |
| flarum-emoji | v0.1.0-beta.12 | |
| flarum-lang-english | v0.1.0-beta.12 | |
| flarum-flags | v0.1.0-beta.12 | |
| flarum-likes | v0.1.0-beta.12 | |
| flarum-lock | v0.1.0-beta.12 | |
| flarum-markdown | v0.1.0-beta.12 | |
| flarum-mentions | v0.1.0-beta.12 | |
| flarum-statistics | v0.1.0-beta.12 | |
| flarum-sticky | v0.1.0-beta.12 | |
| flarum-subscriptions | v0.1.0-beta.12 | |
| flarum-suspend | v0.1.0-beta.12 | |
| flarum-tags | v0.1.0-beta.12 | |
| fof-byobu | 0.4.4 | |
| fof-upload | 0.8.3 | |
+----------------------+----------------+--------+
Tried to disable extensions, but no luck whatsoever.
Found something, messaging works when using "fof/byobu": "0.4.1",
. Error is gone.
I (believe) I was able to find the cause of this: if the user sets a primary tag to force discussions into, but that tag doesn't exist, this error occurs.
You're right, @askvortsov1! Once defining a existing primary tag, it works without any issues. Thanks a lot for pointing that out!
I did some tests and I replicated @askvortsov1 report. It was due to an invalid slug.
I prepared this PR to improve the error message, anyone wants to take a look before I merge ? https://github.com/FriendsOfFlarum/byobu/pull/105
I don't see any proper way to "fix" this. All we can do is at least provide a useful error. With my PR the error would look like this:
Another, maybe better option, would be to set the tag server-side, that way we can return a validation message that says the tag was invalid (currently the tag is set client-side, and only validated server-side)
Nice one @clarkwinkelmann
I think this is a good interim solution to the problem. Longer term, I think a solution that uses a drop-down picker would be useful.
When submitting a private discussion it ends up in a JS error:![image](https://user-images.githubusercontent.com/2029878/76688942-89cfa300-6629-11ea-81cb-b970ab491096.png)
The error:
Flarum info:
I know the error is not really helpful, but please just let me know if you need any further details. Thanks for any help in advance!