Error creating users on 3.6

Hi,
anyone having an error when creating a new user in 3.6?
Iā€™m Getting this error: ā€˜Error: Please enter a valid languageā€™

If someone knows what to try will be helpful, many thanks.

Is that in a fresh installation or an updated project?

Itā€™s an updated project

I just tried this in one of my updated projects as well (from 3.5.7.1) and it fails a bit differently but it fails. I used the same language (EspaƱol) as @isaactopo.

Once I press the create user button as admin, I get the panel error view with this error message:
The JSON response could not be parsed

When looking into the JSON response from users I get:
NaN null

The user isnā€™t actually created, fails before. Hope it helps, let me know if some of you need more information.

Interesting, because I tried also with Spanish in a fresh Starterkit and couldnā€™t reproduce the error.

Do you also get the error in a Starterkit? I guess you have done all the necessary steps needed for updating (remove cache, media folder)?

Hm. I tried it again now differently. On the local system (upgraded site, via composer) it does work seamlessly, without cleaning media or cache folder. On remote, production server it does not work, even after cleaning media/ and site/cache folder.

A bit off topic but does composer update clean both folders automatically? Itā€™s unclear in the docs but suggests it does so.

For my updated project I tried a few things:

  • Deleted Cache
  • Deleted Media folder
  • Deleted previous Users
  • Tried a lot of different languages for the user (all languages fail)
  • Deleted Trevor Plugin (in case it could be related to the language issue)

Plugins I have installed:

  • afbora/kirby-minify-html
  • hashsandsalt/kirby3-schema
  • isaactopo/vcard-kirby3
  • medienbaecker/autofavicon
  • omz13/htmlsitemap
  • omz13/xmlsitemap
  • pedroborges/meta-tags
  • sylvainjule/locator
  • sylvainjule/pagetable

With a Fresh StarterKit is all working well.
Let me know if you need more information.
Thanks.

Are the plugins all up-to-date (although I donā€™t really see how they would be related to the issue)?

From which version did you try to update?

As which type of user are you trying to create the new user? As admin or as collaborator? Fishing in the dark here, just trying to rule things out.

In my case, yes.

As admin.

@helloanselm In your case I find it interesting that you have no issues locally but on the remote server only (different PHP version, server-side caching ā€¦). Question is what are the differences here apart from composer update/non-composer update.

composer update shouldnā€™t remove the media/cache/session folders.

I found another issue on another instance. When trying to create a new page via the Panel I get the popover but when trying to create/save, I get the Kirby panel error view stating

The JSON response could not be parsed
Failed to load resource: the server responded with a status of 403 () in https://hostname.com/panel/dialogs/pages/create?language=de

Iā€™m not entirely sure it is related but it behaves very similar to the issue above and I could imagine itā€™s only a different error message but the same root cause?

@texnixe Any idea on this, I wonder why something would have changed only due to the upgrade. And now Iā€™m not entirely sure which permissions to try to fix without breaking something else.

UPDATE: The JSON response itself when being called (without data from the form, just manually) returns well and without any errors.

Found the reason for this issue and solved this one as well as the other one (here, not sure itā€™s an universal solution).

The server Kirby is running on has mod_security enabled by default with the OWASP configuration as part of the firewall. This causes the 403 with the Kirby Panel payload with the error message:

[Tue Dec 07 10:19:25 2021] [error] [client ā€¦] ModSecurity: Access denied with code 403 (phase 2). Match of "within %{tx.allowed_request_content_type}" against "TX:0" required. [file "/usr/local/apache2/conf/modsecurity/base_rules/modsecurity_crs_30_http_policy.conf"] [line "63"] [id "960010"] [msg "Request content type is not allowed by policy"] [data "text/plain"] [severity "WARNING"] [tag "POLICY/ENCODING_NOT_ALLOWED"] [tag "WASCTC/WASC-20"] [tag "OWASP_TOP_10/A1"] [tag "OWASP_AppSensor/EE2"] [tag "PCI/12.1"] [hostname "domain.de"] [uri "/panel/dialogs/pages/create"] [unique_id "ā€¦"]

Disabling the firewall ā€œsolvesā€ the issue, however I think the causing problem is that JSON is being served as text/plain here? Is that an issue that could be solved via Kirby or somehow differently?
Disabling the firewall isnā€™t what I actually intend to do because the firewall does way more than just that. Ideas?

I have solved the issue deleting the previous languages installed and starting from scratch. But I think this could be a real issue if you update to 3.6 a whole project with more than one language?

@texnixe If you add a new language to the Raw Starterkit (I have tried with Spanish) and then try to add a new User you can reproduce the initial error. Iā€™m using MAMP with 7.4.21.
Let me know if you need more info.
Thanks

I was now able to reproduce the error, when I add Spanish as the only language. Strangely doesnā€™t happen when I use English, German, or French as the only language, or if there is another language besides Spanish. Can you confirm these findings, @isaactopo?

Yes, i can confirm this behaviour. Curiously, the dialog to add a new language auto-completes the fields with other languages (English, Frenchā€¦) but not in Spanish.

I created an issue on GitHub:

Please feel free to add your comments or any further information.

1 Like

Thanks @texnixe hopefully is easy to solve!