F:\git\TaunDevs\payload\node_modules\graphql\type\schema.js:219
throw new Error(
^
Error: Schema must contain uniquely named types but contains multiple types named "Media".
at new GraphQLSchema (F:\git\TaunDevs\payload\node_modules\graphql\type\schema.js:219:15)
at registerSchema (F:\git\TaunDevs\payload\node_modules\payload\src\graphql\registerSchema.ts:77:20)
at BasePayload.init (F:\git\TaunDevs\payload\node_modules\payload\src\payload.ts:210:21)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at getPayload (F:\git\TaunDevs\payload\node_modules\payload\src\payload.ts:431:22)
at initHTTP (F:\git\TaunDevs\payload\node_modules\payload\src\initHTTP.ts:25:19)
at Payload.init (F:\git\TaunDevs\payload\node_modules\payload\src\index.ts:12:21)
[nodemon] app crashed - waiting for file changes before starting...
payload-types.ts
Should I be deleting a string of code within the payload-types.ts file? How does that file get modified? I didn't make any changes to it.
Found the file, though I haven't a clue what to do.
Or I'm not understanding the clue.
Anyone have an idea? @notchr ?
Lets see
@taun2160 Try to regenerate your types first
check the package.json, I think the command is
generate:types
you can also regenerate the graphqlschema via
generate:graphQLSchema
npm run generate:types
(or yarn)
Your app may be stuck in a state where you have two conflicting defs
That's my first guess, let me know if that works
so this is because you have two "things" called Media
it could be a block and a collection
That was my second guess haha
like, if you have a block with the slug of
media
and a collection with slug
media
, that will be a conflict
But I figured it would have complained prior to them reaching this error
yeah, is this new? or a result of something you added?
I see, thanks guys
I'm hacking together a mix of custom-website-series and payload-website, so this makes sense 😛
Happens to the best of us, let us know if you're able to solve it
also @jmikrut not to hijack the thread, but in core-dev i posted a question regarding default save behavior on fields because i encountered an oddity
ok ill check that out right now
Thanks man! No rush btw, I'm close to wrapping up for the day
Hello, I'm having the same error: unhandledRejection Error: Schema must contain uniquely named types but contains multiple types named "Media". I copied the code from the GitHub repo "custom-website-series" and the slug media could be found twice One is in the collections/Media and the second one is in blocks/Media. When I change the slug in the blocks/Media to let us say I change the slug and types to "image" and regenerate payload-types and start the server I wouldn't get any error message but the browser wouldn't be able to load anything.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.