Informations
What is the current behavior?
After installing GraphQL extension (using the admin panel or CLI doesn't matter) and server restart the application is unable to start due to the error:
[2018-08-02T13:10:51.445Z] info The server is restarting
[2018-08-02T13:10:51.447Z] debug POST /content-type-builder/models/ (70 ms)
/usr/src/api/ace-headless-cms/node_modules/mongodb/lib/operations/mongo_client_ops.js:439
throw err;
^
GraphQLError: Syntax Error: Expected :, found Name "name"
at syntaxError (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/error/syntaxError.js:24:10)
at expect (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:1299:32)
at parseFieldDefinition (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:811:3)
at many (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:1350:16)
at parseFieldsDefinition (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:799:50)
at parseObjectTypeDefinition (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:757:16)
at parseTypeSystemDefinition (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:663:16)
at parseDefinition (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:149:12)
at parseDocument (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:110:22)
at Object.parse (/usr/src/api/ace-headless-cms/plugins/graphql/node_modules/graphql/language/parser.js:38:10)
at Object.addPolymorphicUnionType (/usr/src/api/ace-headless-cms/plugins/graphql/services/GraphQL.js:804:27)
at Object.generateSchema (/usr/src/api/ace-headless-cms/plugins/graphql/services/GraphQL.js:722:58)
at Function.initialize (/usr/src/api/ace-headless-cms/plugins/graphql/hooks/graphql/index.js:103:62)
at /usr/local/lib/node_modules/strapi/lib/hooks/index.js:19:29
at after (/usr/local/lib/node_modules/strapi/lib/hooks/index.js:122:39)
at /usr/local/lib/node_modules/strapi/node_modules/lodash/lodash.js:9997:23
at Strapi.once (/usr/local/lib/node_modules/strapi/lib/hooks/index.js:133:17)
at Object.onceWrapper (events.js:272:13)
at Strapi.emit (events.js:180:13)
at Strapi.emit (domain.js:422:20)
at loadedModule.initialize.call.err (/usr/local/lib/node_modules/strapi/lib/hooks/index.js:32:12)
at NativeConnection.instance.connection.on (/usr/src/api/ace-headless-cms/node_modules/strapi-hook-mongoose/lib/index.js:459:11)
Steps to reproduce the problem
What is the expected behavior?
The app should start normally without errors.
Same problem !
I don't believe any testing has been done using AL, the current supported OSes are Ubuntu, Centos (RHEL), and MacOS.
This looks to be an issue with Mongo, @elisegriset92 & @dannydtk what version of mongo is installed?
@derrickmehaffy
Strapi is running in a Docker container which is Alpine 3.6.2.
Mongo is running in a Docker container which is Ubuntu 16.04 x64.
Mongo version:
db version v4.0.0
git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64
Basic functionality works as expected. The problem occurs when installing GraphQL extension.
@dannydtk can you try running the 3.6 version of Mongo? I just noticed that a new version was released in June and I'm not sure if any testing was done with Strapi and v4.0.0.
Also assuming you authentication enabled on that docker container for Mongo and/or have tested flipping the SSL flag in Strapi for it?
@derrickmehaffy Yep, I have database auth enabled and set to 'admin' db. SSL flag disabled ('false'). I'll try to check it with the mentioned Mongo version later on.
Is your issue related to Docker usage ?
Can you please give us an update about this issue?
+1.
Also facing this problem with a remote Mongo hosted on Mongo Atlas.
Can you try to create new app and install GraphQL plugin (without creating new content type) and tell me if you have the issue.
Just to know if it's based on existing plugins models or on your custom content types
The problem may be caused by Syntax Error: for instance a space between...
Example:
in a file 'myproject/api/song/models/Song.settings.json'
PROBLEM
"attributes": {
"_record label_": {
"model": "_record label_",
"via": "songs"
}
}
SOLUTION
=> remove space, it worked for me
"attributes": {
"_recordlabel_": {
"model": "_recordlabel_",
"via": "songs"
}
}
Strapi seems to struggle quite a bit with camelCase or spaced names
I too got stuck here. I'm learning & exploring strapi with Strapi Deliveroo clone with Next.js & GraphQL (https://blog.strapi.io/strapi-next-restaurants/). After hitting (installing) strapi install graphql even downgrading and without downgrading both outputs same error.
_PS: Obviously, I made restaurant Content Type already as demonstrated in blog._
PS D:\Playground\StrapiIO\strapi-deliveroo\backend> strapi start
[2018-11-06T22:31:42.667Z] debug ⛔️ Server wasn't able to start properly.
[2018-11-06T22:31:42.669Z] error Cannot find module 'D:\Playground\StrapiIO\strapi-deliveroo\backend\node_modules\strapi\lib\utils'
{ Error: Cannot find module 'D:\Playground\StrapiIO\strapi-deliveroo\backend\node_modules\strapi\lib\utils'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Function.beforeInitialize (D:\Playground\StrapiIO\strapi-deliveroo\backend\plugins\graphql\hooks\graphql\index.js:25:21)
at Promise.all.Object.keys.map (C:\Users\username\AppData\Roaming\npm\node_modules\strapi\lib\hooks\index.js:50:47)
at Array.map (<anonymous>)
at Strapi.module.exports (C:\Users\username\AppData\Roaming\npm\node_modules\strapi\lib\hooks\index.js:41:28)
at Strapi.load (C:\Users\username\AppData\Roaming\npm\node_modules\strapi\lib\Strapi.js:229:74)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7) code: 'MODULE_NOT_FOUND' }
PS D:\Playground\StrapiIO\strapi-deliveroo\backend>
Hey @lauriejim & @pierreburgy, is this not a serious bug which needs to be resolved?
Is there any workaround if you're not working over this? Why the priority set to medium??
I can't move ahead strapi-deliveroo tutorial after installing graphql plugin, how did you made rest of tutorial series even you stuck at this point? haah !!
I am getting the following error after installing GraphQL. Strapi is not starting.
After uninstall GraphQL, strapi starts fine and my app is running ok.
As mentioned below ensureIndex is deprecated in Nodejs >10.
debug GET f5605e1347775a7276c42bee1847195f.svg (4 ms)
(node:14241) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(node:14241) UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error: Invalid number, expected digit but got: "m".1
Same issue after 'strapi install graphql':
Ryans-Air:strapi rw3iss$ strapi start
(node:83100) UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error: Invalid number, expected digit but got: "t".
at syntaxError (/Users/rw3iss/Sites/kkjay/src/strapi/plugins/graphql/node_modules/graphql/error/syntaxError.js:24:10)
Node.js version: 10.11.0
npm version: 6.4.1
Strapi version: 3.0.0-alpha.14.5
Database: mysql
Operating system: OSX High Sierra
Bumping this as I am unable to move forward with using Strapi with GraphQL as things stand. Please provide a solution or workaround. :)
@JayWelsh you have a problem with data in your database or a field type somewhere.
Syntax Error: Invalid number, expected digit but got: "t".
@dannydtk thanks for the quick reply. Here is the error I got:
(node:28107) UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error: Expected :, found Name "Name"
@JayWelsh is your project on github somewhere?
This isn't really a Strapi issue but a syntax problem somewhere in your project. If you create a new Strapi app and try and install the GraphQL plugin does it work?
@derrickmehaffy As things stand, I have just made a new Strapi app and made one new content type and added one item to it, please view my attached screenshot. I would appreciate if you can see what might be causing the issue. :+1:

Kindest Regards,
Jay
@JayWelsh can you give me the view of that model in the type-builder?
Specifically i want to see how this is defined:

That is likely where your syntax error is based on:
(node:28107) UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error: Expected :, found Name "Name"
@derrickmehaffy is this what you are asking for? :) I seriously appreciate the help man, thank you!

Yup (wrong person btw :wink: )
Thats your problem right there:

Content type fields need to be all lowercase and contain no spaces or special chars. You can change the "look" in the adminUI using the content Manager plugin.
GraphQL is very very very strict, while strapi doesn't have the proper checks in place to ensure things are formatted properly.
@derrickmehaffy you are the best! Working perfectly now! Thank you so much, Brother!
@JayWelsh no problem man
For utils issue please check this issue https://github.com/strapi/strapi/issues/1612
For other issue, please use lowercase attributes.
Can confirm @derrickmehaffy is the boss. Field names with spaces break this, so uninstall graphql plugin, correct your field names and then re-install.
I just had this issue as well. The issue was with a hyphen in one of my attributes. IE 'header-image'. I changed it to 'headerImage' and it fixed the issue. My solution to the problem was in my api directory. I fixed this issue by navigating to api > "yourContentType" > models. Look for anything you may have used a hyphen on or a space on as mentioned by @derrickmehaffy and @codepotato
@JayWelsh you have a problem with data in your database or a field type somewhere.
Syntax Error: Invalid number, expected digit but got: "t".
@derrickmehaffy
Same issue here. Would you be so kind to tell how to debug this incorrect data in the database? I have removed all relations and installed graphql plugin once again, still no luck... Getting:
UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error: Invalid number, expected digit but got: "m".
@AlexanderTserkovniy somewhere you have a letter in an integer/float/bigint spot. Not sure how you did it. That or you have your field name or model name with a space/symbol in it.
You are welcome to PM me a link to your repo, or zip the api directory up and send it to me in a PM on slack and I can dig through it.
@derrickmehaffy just did that in Slack, thanks.
Update: this error may also be caused by dashes in enum properties, just confirmed it with sqlite3 and MongoDB.
Example:
GraphQLError: Syntax Error: Invalid number, expected digit but got: "w".
Culprit: enum property with value "one-way" (letter w after dash is indicated in the error).
@derrickmehaffy What'd be the best way to make the developer / user experience better here?
There are probably multiple contexts with their own specific requirements concerning the field names of content types:
It probably makes to think about this holistically. Is anything like this planned for the future?
Im the short term, if the following is a hard requirement across strapi I think one way would be to just disallow field names that contain non-lowercase characters during field creation. This would probably introduce breaking behaviour for existing installations however.
Content type fields need to be all lowercase and contain no spaces or special chars. You can change the "look" in the adminUI using the content Manager plugin.
If it's just a problem with the GraphQL plugin I think one way to improve the experience here would be to delegate the transformation of the field names to the plugin itself, or introduce a way to deal with context-specific field names across the board as highlighted above.
In the short term a way to improve developer experience might be to simply catch the GraphQL schema errors and display an appropriate warning message in the admin UI and disable the GraphQL endpoint until the schema is fixed.
@hokkaido Some stuff is already in the works here (scheduled for beta.16 release I believe for some of the adminUI restrictions in place) However that being said in many of these cases the related technologies can support them if the data is provided in the correct format.
On that note, it is planned see the July Strapi blog post: https://blog.strapi.io/monthly-update-july-2019/
Specifically:

I'm sure as time goes on this will have more input and modifications. The best way if you wanted to contribute would be to write up an RFC and do some of your own independent research for it.
You can access the RFC repo here: https://github.com/strapi/rfcs
@derrickmehaffy Hey, thanks for the quick reply :) Much appreciated!
I got this error "GraphQLError: Syntax Error: Invalid number, expected digit but got: "p"." because i somehow can't call an api with a (-) between the words.
Like this: featured-products
Hello @DutchPrince, can you precise your issue and steps to reproduce, please.
Hi,
I faced the same issue after graphQL ext installed, strapi stopped
working,. I found the solution that graphQL is looking for proper table
names and column names, it won't accept '_-~ and space. Change your
columns and try again. For me this worked two years ago. Still no update
from graphQL.
with regards
Sridhar DK
On Mon 20 Jan, 2020, 4:58 AM Jim LAURIE, notifications@github.com wrote:
Hello @DutchPrince https://github.com/DutchPrince, can you precise your
issue and steps to reproduce, please.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/strapi/strapi/issues/1687?email_source=notifications&email_token=AAISAPLYR5YS5AOW7GUFIL3Q6TOZ5A5CNFSM4FNRGD62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJK7SYA#issuecomment-576059744,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAISAPLN2S7EIFNQKFJIXT3Q6TOZ5ANCNFSM4FNRGD6Q
.
Hello @sridkdhar !
I just tested w/ _ in my content type and GraphQL works fine.
Here is what I did - https://www.loom.com/share/1a233a1071b44d87af4e9d70bd5487c4
Let me know if I missed something (that's last version of strapi - beta.18.4)
Hi,
may be I am missing some thing, check this link
"[question] why names cannot contain dash '-' · Issue #479 ·
graphql/graphql-spec · GitHub"
https://github.com/graphql/graphql-spec/issues/479
Fyi
with regards
Sridhar DK
On Mon 20 Jan, 2020, 9:01 AM Sridhar DK, sridkdhar@gmail.com wrote:
Hi,
I faced the same issue after graphQL ext installed, strapi stopped
working,. I found the solution that graphQL is looking for proper table
names and column names, it won't accept '_-~ and space. Change your
columns and try again. For me this worked two years ago. Still no update
from graphQL.with regards
Sridhar DKOn Mon 20 Jan, 2020, 4:58 AM Jim LAURIE, notifications@github.com wrote:
Hello @DutchPrince https://github.com/DutchPrince, can you precise
your issue and steps to reproduce, please.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/strapi/strapi/issues/1687?email_source=notifications&email_token=AAISAPLYR5YS5AOW7GUFIL3Q6TOZ5A5CNFSM4FNRGD62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJK7SYA#issuecomment-576059744,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAISAPLN2S7EIFNQKFJIXT3Q6TOZ5ANCNFSM4FNRGD6Q
.
Strapi normalizes the content type names with graphql so a model named like @lauriejim made content_type in the Strapi backend becomes content-type (this is for use with services and queries) and contentType in graphql. This provides the most compatibility with the entire ecosystem.
Most helpful comment
Yup (wrong person btw :wink: )
Thats your problem right there:

Content type fields need to be all lowercase and contain no spaces or special chars. You can change the "look" in the adminUI using the content Manager plugin.
GraphQL is very very very strict, while strapi doesn't have the proper checks in place to ensure things are formatted properly.