I tried gatsby-source-mongodb with a database name with 2 dashes (something like one-two-three) and it seems the name is not properly sanitized. I get the following error when trying to build:
Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "mongodbOnetwo-ThreeDocumentsConnectionSortByFieldsEnum" does not.
I think the culprit is a missing g in the regular expression of the sanitizeName function in that plug in:
function sanitizeName(s) {
return s.replace(/[^_a-zA-Z0-9]/, ``).replace(/\b\w/g, l => l.toUpperCase())
}
The first replace stops after the first dash. s.replace(/[^_a-zA-Z0-9]/, ``) should be s.replace(/[^_a-zA-Z0-9]/g, ``).
Change the name of the database in using-mongodb and run gatsby develop.
The database name one-two-three should be sanitized to Onetwothree (assuming that was the intention and not OneTwoThree) and the build shouldn't fail.
Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "mongodbOnetwo-ThreeDocumentsConnectionSortByFieldsEnum" does not.
System:
OS: macOS 10.14.2
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Shell: 3.0.0 - /usr/local/bin/fish
Binaries:
Node: 11.7.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.6.0 - /usr/local/bin/npm
Languages:
Python: 2.7.15 - /usr/local/bin/python
Browsers:
Chrome: 71.0.3578.98
Firefox: 64.0.2
Safari: 12.0.2
npmPackages:
gatsby: ^2.0.0 => 2.0.97
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.5
gatsby-source-mongodb: ^2.0.5 => 2.0.10
gatsby-transformer-remark: ^2.1.1 => 2.2.0
npmGlobalPackages:
gatsby-cli: 2.4.8
Thank you for opening this and for debugging the issue @raulrpearson
Seems like an easy fix! Would you be interested in opening a PR? We'd love to accept one 馃檪
Yeah I would like to take this one
Awesome, thanks @harshil1712
Would you be interested in opening a PR? We'd love to accept one
Thanks, @sidharthachatterjee. Would have loved to submit a PR, but it seems you have to move quickly here 馃槀 . Maybe next time.
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Not stale. Will be solved when #11294 is merged.
Hey again!
It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.
Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
Thanks again for being part of the Gatsby community!