-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Unknown field 'doczDb' on type 'Query' #994
Comments
I get this bug too, still cannot figure out how to fix it. |
The same here! |
Same here. Any luck on fixing this? |
Seems like my problem was with my node version, I updated to the latest version (v12.8.0) and now is working for me. |
I'm getting the same problem. Upgrading node didn't fix it. |
I found this error went away when I removed gatsby-config.js which I was using to load the gatsby sass plugin.
After that, I could never get any combination of loaders ('css-loader', 'postcss-loader', 'sass-loader',...) to work. I was getting all sorts of errors loading gatsby-docz-theme. (eg: "unknown word") as well as trying to load my scss files. I finally ditched all that and just ran sass cli to transform my stylesheets and removed sass-loader from my webpack config. That worked and I finally got docz to build!!! On a side-note it looked awful. It appears my bulma styles were conflicting with docz styles. Waiting patiently for some more releases - looking forward to the new version once its stable. :) |
Could you please provide the rest of the command output ? There might be another clue there into what's happening |
Facing the same issue, the thing I have common with @dusty is that I tried adding a custom gatsby plugin in a file in /gatsby-config.js
Docz ended up generating the following gatsby-config.js file in .docz folder with gatsby-config.custom.js having my plugin code
I dont know much about lodash fp but the merge function apparently doesnt seem to merge array properties. It just overwrites the property value with the newest value
Hence your plugin configuration for gatsby-theme-docz must be getting lost as soon as we add our own plugins as
|
Hey @rahulrmetocean I think you're right, yours and @dusty's problem are from a problem with merging the plugins field in the gatsby config files. Going to open a separate issue to track that problem. For future readers who encounter this, make sure to :
|
I still ran into this when having My setup does not render the docs on production, but in all other cases. My workaround is to create the missing db docz entry. This at least let me build the website. It is not fixing the actual issue at all. Thats my gatsby-node.js: /**
* This whole file is a workaround to prevent docz from failing when the
* dependency is installed but gatsby-theme-docz is excluded in the gatsby-config.js
*
* Maybe related: https://github.com/doczjs/docz/issues/994
*/
const crypto = require('crypto')
const digest = (str) =>
crypto
.createHash('md5')
.update(str)
.digest('hex')
const isProduction = process.env.NODE_ENV === 'production'
const isStaging = !!process.env.STAGING
const renderDocs = isStaging || !isProduction
/**
* If the docs are not rendered, create a fake db entry to prevent the parser for
* useStaticQuery from failing via
*
* ERROR #85901 GRAPHQL
*
* There was an error in your GraphQL query:
*
* Cannot query field "doczDb" on type "Query".
*
* GraphQL request:3:9
* 2 | query {
* 3 | doczDb {
* | ^
* 4 | id
*
* File: node_modules/gatsby-theme-docz/src/hooks/useDbQuery.js:7:9
*/
exports.sourceNodes = ({ actions, createNodeId }, { forceDocs = false }) => {
if (forceDocs || renderDocs) {
console.log('skipping')
return
}
console.log('faking docs db')
const { createNode } = actions
const db = JSON.stringify({})
const contentDigest = digest(db)
const node = {
id: createNodeId('docz-db'),
db,
children: [],
internal: {
contentDigest,
type: 'DoczDb',
},
}
createNode(node)
} |
I'm sorry I'm not sure I understand what you mean by this. You've installed the dependency but didn't include as a gatsby plugin in your configuration ? Any chance the project you're working on is open-source so I can take a look ? |
Exactly. As docz adds dependencies and increases the bundle size even for pages outside of the / route, I don't include
Its very WIP and currently only works with the contentful starter. I am working on it currently on a daily basis and will polish both starters very soon. |
For anyone still struggling with this issue, I fixed it on my end by replacing this line: // doczrc.js
ignore: "README.md", with this one: // doczrc.js
ignore: ["README.md"], |
For me, this resolved when I downgraded gatsby from 3.* to 2.* Some of the gatsby-plugins docz uses had compatibility issues. An alternative which might be worth exploring instead would be to install updated versions of the plugins. Hope this helps. Love this effin tool. |
@ tiyunchen |
@hellcoldby try to use the latest bumped version of docz ( |
Bug Report
I keep getting this error when installing the Gatsby theme:
Environment
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.4.1 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.10.2 - /usr/local/bin/npm
Languages:
Python: 2.7.15 - /usr/local/bin/python
Browsers:
Chrome: 75.0.3770.142
Firefox: 68.0
Safari: 12.1.1
npmPackages:
gatsby: ^2.13.52 => 2.13.52
gatsby-theme-docz: ^2.0.0-rc.1 => 2.0.0-rc.1
npmGlobalPackages:
gatsby-cli: 2.7.20
The text was updated successfully, but these errors were encountered: