Strapi Error: Expected New to be a objectType, saw GraphQLScalarType

System Information
  • Strapi Version 4.2.0:
  • Mac Dev environment:
  • **PostgresSQL 13 **:
  • Node Version v14.19.1:
  • Yarn Version 1.22.19:

We removed a collection type in admin and Strapi crashed. Now when i restart Strapi yarn develop i get this error:

Error: Expected New to be a objectType, saw GraphQLScalarType
at SchemaBuilder.getObjectType (/backend/node_modules/nexus/dist/builder.js:890:19)
at /backend/node_modules/nexus/dist/builder.js:719:36
at Array.forEach ()
at SchemaBuilder.buildUnionMembers (/backend/node_modules/nexus/dist/builder.js:718:17)
at types (/backend/node_modules/nexus/dist/builder.js:667:31)
at resolveThunk (/backend/node_modules/graphql/type/definition.js:480:40)
at defineTypes (/backend/node_modules/graphql/type/definition.js:944:15)
at GraphQLUnionType.getTypes (/backend/node_modules/graphql/type/definition.js:900:26)
at collectReferencedTypes (/backend/node_modules/graphql/type/schema.js:356:59)
at new GraphQLSchema (/backend/node_modules/graphql/type/schema.js:148:9)

Any help greatly appreciated, I have no idea how to fix this and Strapi is now completely useless because of this if anyone can shed some light that would be great as if this was to happen in production it would be catastrophic

Same issue here after removing a collection type

It might be related to some of the plugin configurations. In my case, I fixed taking the relationship with the content type out of the UI Navigation plugin first that I’m using. After that, I could delete the content type safely.

We ended up fixing this one of two ways. As explained above removing the UI Navigation content relations was one way in the settings and the second ways is to just start with a a fresh database however this means re-adding all your content. option one is faster however if you already have the error it may be harder to rectify hence option two.