Recently, started getting this error when trying to run
payload generate:graphQLSchema
:
payload/node_modules/graphql/utilities/printSchema.js:54
const directives = schema.getDirectives().filter(directiveFilter);
^
TypeError: Cannot read properties of undefined (reading 'getDirectives')
The full command I'm using is
dotenv payload generate:graphQLSchema
, and
PAYLOAD_CONFIG_PATH
is defined in .env, though I have also tried running it with
-v PAYLOAD_CONFIG_PATH=src/payload.config.ts
just to be sure.
I have generated the GraphQL schema successfully recently, so wondering if this looks familiar to anyone.
Fixed in 1.6.3
https://github.com/payloadcms/payload/releases/tag/v1.6.3@denolfe Thanks!
@denolfe I am getting a different error
const err = new MongooseError(message);
^
MongooseError: Operation
users.countDocuments()
buffering timed out after 10000ms
I updated to version 1.6.12
That typically indicates a connectivity issue to your mongo server
or a permissions issue
@denolfe what kind of permissions issue? I can spin up just fine with
yarn dev
(so mongo is running and payload can connect) but I'm also getting this connection timeout, first time trying to generate schema
Interesting, so the app works fine normally. You
onlyget this when generating schema?
Correct
Definitely odd, Payload version?
1.8.2
I've made some changes to my server.ts, not sure if that could be related
No, that shouldn't be an issue
Can you paste the script you're running to generate types from your package.json?
Should be something like
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.js payload generate:graphQLSchema",
and for reference
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.js nodemon",
(not using typescript, not sure if that could be related as well)
One other data point, I'm overriding the routes as follows:
routes: {
admin: '/cms/admin',
api: '/cms/api',
graphQL: '/cms/graphql',
graphQLPlayground: '/cms/graphiql',
},
and this 404s:
http://localhost:3000/cms/graphql
maybe thats expected though since there's no query?
This also 404s:
http://localhost:3000/cms/graphiqlThere could be something going on there, since I think
graphQLPlayground
builds upon
api
. Here are the defaults:
routes: {
admin: '/admin',
api: '/api',
graphQL: '/graphql',
graphQLPlayground: '/graphql-playground',
},
I don't believe the JS would be an issue since this just executes a JS script that we ship with the package
Maybe remove the routes temporarily and see if it runs differently
The way you have your routes would actually make graphQLPlayground URL be
/cms/api/cms/graphiql
or something like that
AH didn't realize it was building off of api
Alright playground is working at least
So it looks like it's actually running some queries on the data, if there was a bug in my config that passed validation, but was otherwise breaking the API, would that explain it? It's certainly possible I have some broken hook or infinite loop somewhere that I haven't stumbled on (though I kinda assumed this would be generated from static config data)
MongooseError: Operation
centers.countDocuments()
buffering timed out after 10000ms
So I've implemented a little shell and I just tried running that query directly on the centers model and its returning 6 (which is correct)
I spun up a new payload app and generate schema is working just fine, so it's gotta be something specific to my config
Seems like that is only called within
auth
?
https://github.com/search?q=repo%3Apayloadcms%2Fpayload+countDocuments&type=code
well not sure whats going on, but I just rewrote the script and called it from my custom management command runner and it worked...
a code gremlin
I tried using a local version of payload with one scss change via
yarn link
but got also the error
MongooseError: Operation admins.countDocuments() buffering timed out after 10000ms
(admins is my admin collection). Is this related or excepted with
yarn link
?
I would not expect linking to cause an issue, we use it at times during development.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.