1 ✕ app unhandledRejection | error Error: Query was already defined and imported as a type, check the docs for extending types | at extendError (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:968:12) | at SchemaBuilder.addType (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:156:23) | at SchemaBuilder.addTypes (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:247:18) | at /Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:250:45 | at Array.forEach (<anonymous>) | at SchemaBuilder.addTypes (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:250:19) | at Object.makeSchemaInternal (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:976:13) | at Object.assemble (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/nexus/dist/runtime/schema/schema.js:60:67) | at Object.assemble (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/nexus/dist/runtime/app.js:72:70) | at eval (eval at main (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/nexus/dist/lib/watcher/runner.js:78:5), <anonymous>:33:20)
If I comment out my Query.ts code, it works and it is still referenced in api.graphql. I was having no issue the day before so this was unexpected, but could there be some caching issues?
The only major change I made was while getting an error by adding an enum to my User model/type and refreshing the schema while the server was running, but this was giving me a server issue but I realized the enum was not updated in the database via the Types section (for reference, I'm using PostgreSQL and pgAdmin).
My solution was to stop the server, manually load those changes with:
On
nexus dev
, I receive this issue:1 ✕ app unhandledRejection | error Error: Query was already defined and imported as a type, check the docs for extending types | at extendError (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:968:12) | at SchemaBuilder.addType (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:156:23) | at SchemaBuilder.addTypes (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:247:18) | at /Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:250:45 | at Array.forEach (<anonymous>) | at SchemaBuilder.addTypes (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:250:19) | at Object.makeSchemaInternal (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/@nexus/schema/dist/builder.js:976:13) | at Object.assemble (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/nexus/dist/runtime/schema/schema.js:60:67) | at Object.assemble (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/nexus/dist/runtime/app.js:72:70) | at eval (eval at main (/Users/stefantrivuncic/Desktop/BelayMe/Code_Base/belayMe/node_modules/nexus/dist/lib/watcher/runner.js:78:5), <anonymous>:33:20)
If I comment out my
Query.ts
code, it works and it is still referenced inapi.graphql
. I was having no issue the day before so this was unexpected, but could there be some caching issues?The only major change I made was while getting an error by adding an enum to my
User
model/type and refreshing the schema while the server was running, but this was giving me a server issue but I realized the enum was not updated in the database via the Types section (for reference, I'm using PostgreSQL and pgAdmin).My solution was to stop the server, manually load those changes with:
npx prisma migrate save --experimental
npx prisma migrate up --experimental
npx prisma generate
and it worked!