maxCharactersLength javascript error in console with 4.5.3 upgrade

System Information
  • Strapi Version: 4.5.3
  • Operating System: MacOS 12.6.1
  • Database: pg 8.6.0
  • Node Version: 16.14
  • NPM Version: 8.3.1
  • Yarn Version:

Tried to upgrade to to 4.5.3 from 4.4.3 (I also tried 4.5.0) and I am getting an error in the dev tools console, just a blank screen when I try to hit the /admin page.

Uncaught (in promise) Invariant Violation: ‘maxLengthCharacters’ must be prefixed with ‘options.’

Downgrading back to 4.4.3 fixes the issue, just wondering if anyone has any insight on it. Thanks.


Did you check the migration guides ?
Did you rebuild the admin panel (delete .cache and build folder)

Hi. I just gave it another go, removing the .cache file, I did not do that last time. I removed the lock file, /.cache, /node_modules, and /build this time, then build and develop. I still get the same error.

There isn’t anything specific in this migration guide, the only version I skipped was 4.4.5, I checked that guide and renaming the favicon was the only step I had to do from there.

The full dev tools output is this:

Uncaught (in promise) Invariant Violation: 'maxLengthCharacters' must be prefixed with 'options.'
    at t (http://localhost:1337/admin/main.a627abc1.js:572:555)
    at http://localhost:1337/admin/main.a627abc1.js:175:22198
    at Array.forEach (<anonymous>)
    at w.register (http://localhost:1337/admin/main.a627abc1.js:175:22145)
    at Object.register (http://localhost:1337/admin/main.a627abc1.js:181:33)
    at http://localhost:1337/admin/admin-app.4993638d.chunk.js:66:12701
    at Array.forEach (<anonymous>)
    at ar.<anonymous> (http://localhost:1337/admin/admin-app.4993638d.chunk.js:66:12670)
    at Generator.next (<anonymous>)
    at http://localhost:1337/admin/admin-app.4993638d.chunk.js:66:5295

I spent a little time after my last post this morning and was able to get everything working. What I had to do was find the location of the “maxLengthCharacters” entry in main.a627abc1.js build file and re-save it with the edit “options.maxLengthCharacters”, now it works fine.

So, I’d say there is a problem somewhere in the build step.

I will give it a go on my remote server, if I have to edit the build fine there as well, I can do that but it makes me a little nervous for future upgrades if I have to keep in mind specific edit(s) to built js files.

I uploaded my schema changes to the remote production server just a bit ago with the latest 4.5.3 set for install. I npm installed then built the admin panel. I ran into the same issue.

So, basically I got into the specific main.xxxxxx.js file where the maxLengthCharacters string is located, did a quick find and appended it to read as options.maxLengthCharacters, this fixes the problem there as well.

Hopefully I won’t have to do this with each new build in future upgrades but it’s not a HUGE problem as it’s not really difficult to do.

1 Like

UPDATE:

It appears that this issue is realated to the ck5 editor plugin, which I added at the same time I upgraded. This property appears in the @ckeditor/strapi-plugin-ckeditor/admin-src/index.js file.

I opened up a new issue in their Github for this problem.

Thanks for this! Saved my day

1 Like

Thanks, very helpful!

upgrading @ckeditor/strapi-plugin-ckeditor to the 0.0.5 should resolve the issue

3 Likes

That’s right! Thanks.

Thanks much for the update! I just upgraded and all is working perfectly. :ok_hand:t3: