Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection names are allowed that do not work with graphql #13338

Closed
Nutramax opened this issue May 16, 2022 · 0 comments
Closed

Collection names are allowed that do not work with graphql #13338

Nutramax opened this issue May 16, 2022 · 0 comments

Comments

@Nutramax
Copy link

Describe the Bug

Collections created starting with numeric or "-" ( dashes ) break queries to POST /graphql

Appears to be a validation issue enforced by graphql express router, but not enforced by validation on the Directus front-end when creating a data model. POST /graphql returns 500

When collections starting with numbers or containing dashes are removed, graphql endpoint works again as expected.

Thanks!

To Reproduce

Create a collection ( Data Model ) with name either starting with numbers or containing "-" ( dashes ). Query graphql. Some queries work, some error. The odd thing is the query can be for an unrelated collection, but the validation error comes up reporting the offending collection name. Perhaps all the collections are looped through regardless of the graphql query and that triggers the error. The result is a 500 from POST /graphql.

Errors Shown

at assertValidSchema (/home/web-nodejs/directus/express-api/node_modules/graphql/type/validate.js:69:11)
at validate (/home/web-nodejs/directus/express-api/node_modules/graphql/validation/validate.js:51:35)
at GraphQLService.execute (/home/web-nodejs/directus/express-api/node_modules/directus/dist/services/graphql.js:92:57)
at /home/web-nodejs/directus/express-api/node_modules/directus/dist/controllers/graphql.js:27:40
at scoped (/home/web-nodejs/directus/express-api/node_modules/directus/dist/utils/async-handler.js:5:60)
at Layer.handle [as handle_request] (/home/web-nodejs/directus/express-api/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/web-nodejs/directus/express-api/node_modules/express/lib/router/index.js:328:13)
at /home/web-nodejs/directus/express-api/node_modules/express/lib/router/index.js:286:9
at Function.process_params (/home/web-nodejs/directus/express-api/node_modules/express/lib/router/index.js:346:12)
at next (/home/web-nodejs/directus/express-api/node_modules/express/lib/router/index.js:280:10)
17:43:58 🚨 Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "410_Webpage_Numbers" does not.

What version of Directus are you using?

9.10.0

What version of Node.js are you using?

v14.19.2

What database are you using?

MySQLl 5.7.x

What browser are you using?

Chrome

How are you deploying Directus?

server

@directus directus locked and limited conversation to collaborators May 16, 2022
@rijkvanzanten rijkvanzanten converted this issue into discussion #13339 May 16, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants