Strapi Can not start server with Cannot read properties of undefined (reading ‘toLowerCase’)
I encounter this error while building a backend app with Strapi.io
--------------------------------------
$ strapi develop
✔ Cleaning dist dir (8ms)
⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
- ADMIN_PATH
- STRAPI_ADMIN_BACKEND_URL
- STRAPI_TELEMETRY_DISABLED
✔ Building build context (138ms)
✔ Creating admin (7498ms)
⠸ Loading Strapi[ERROR] There seems to be an unexpected error, try again with --debug for more information
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ ││ TypeError: Cannot read properties of undefined (reading 'toLowerCase') ││ at Function.singular (/Users/yj/projects/apis/apis-strapi/node_modules/pluralize/pluralize.js:136:24) ││ at getTypeName ││ (/Users/yj/projects/apis/apis-strapi/node_modules/@strapi/plugin-graphql/dist/server/index.js:873:79) ││ at getEntityName ││ (/Users/yj/projects/apis/apis-strapi/node_modules/@strapi/plugin-graphql/dist/server/index.js:877:15) ││ at Object.getEntityResponseName ││ (/Users/yj/projects/apis/apis-strapi/node_modules/@strapi/plugin-graphql/dist/server/index.js:883:15) ││ at addRegularRelationalAttribute ││ (/Users/yj/projects/apis/apis-strapi/node_modules/@strapi/plugin-graphql/dist/server/index.js:1575:108) ││ at /Users/yj/projects/apis/apis-strapi/node_modules/@strapi/plugin-graphql/dist/server/index.js:1644:15 ││ at Array.forEach (<anonymous>) ││ at Object.definition ││ (/Users/yj/projects/apis/apis-strapi/node_modules/@strapi/plugin-graphql/dist/server/index.js:1618:96) ││ at SchemaBuilder.walkOutputType ││ (/Users/yj/projects/apis/apis-strapi/node_modules/nexus/dist/builder.js:1030:13) ││ at SchemaBuilder.walkTypes (/Users/yj/projects/apis/apis-strapi/node_modules/nexus/dist/builder.js:308:26) ││ │└────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
✨ Done in 12.96s.
This happens when
You have a field you've added to one of your Collection Type that has missing Collection relationships.
For my case, I've added a new field to Users Collection in
user-permissions/content-type/user/schema.json
it has one of entities
"phone": {
"type": "relation",
"relation": "oneToOne",
"target": "api::phone.phone",
"mappedBy": "creator"
}
and that phone Collection is missing
Once you delete the phone field from user, it works just fine
Cheers
Comments
Post a Comment