A few suggestions:
-
I highly recommend you use TypeScript for building your projects, it can be tremendously valuable in debugging these sorts of things. GraphQL and TypeScript go together really well!
-
You have a typo in one of your directory names in your reproduction —
grapqhl
should begraphql
. I don’t know if this was causing a problem sinc theenum.js
was the same in both places, but I removed it. -
The
schema
was not defined in theindex.js
. I imported it by adding:const { schema } = require('./utils/schema');
-
Your
./utils/schema
is using ECMAScript modules (e.g.,export const
) but the rest of your project is all in CommonJS (e.g., expectingmodule.exports
). -
Once I fixed all these things, I still received the error:
Error: Unknown type "UserRoleEnum". Unknown type "User".
… which seems to show that some pieces are still missing.
I recommend taking a bit more time to put together a reproduction and going through each of the errors I’ve noted above and carefully observing their error messages. In every case except the misspelling of GraphQL (something I personally do all the time by the way!), the console output or VS Code interface (which I also recommend!) showed me the source of the error.
It’s also worth noting that we have a great Apollo Odyssey tutorial available called Lift-off available. It does not use GraphQL Tools (a project which Apollo no longer maintains) but it does require familiarity and comfort with JavaScript.