Basically, I run "docz dev" command and get this output:
pattern-example git:master × npm start
> [email protected] start /Users/rnd/web/projects/slot-fill-pattern/pattern-example
> docz dev
yarn install v1.15.2
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.90s.
✔ Dependencies checked!
yarn run v1.15.2
$ gatsby develop --port 3000
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
success open and validate gatsby-configs - 0.673 s
success load plugins - 0.220 s
success onPreInit - 0.017 s
success initialize cache - 0.021 s
success copy gatsby files - 0.128 s
success onPreBootstrap - 0.048 s
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
warn The gatsby-plugin-mdx plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes - 0.197 s
success Add explicit types - 0.024 s
success Add inferred types - 0.151 s
success Processing types - 0.073 s
success building schema - 0.321 s
ERROR #85901 GRAPHQL
There was an error in your GraphQL query:
Cannot query field "headings" on type "DoczEntries".
File: node_modules/gatsby-theme-docz/lib/createPages.js:27:10
success createPages - 0.059 s
success createPagesStatefully - 0.074 s
success onPreExtractQueries - 0.015 s
success update schema - 0.051 s
success extract queries from components - 0.201 s
success write out requires - 0.054 s
success write out redirect data - 0.021 s
success onPostBootstrap - 0.017 s
⠀
info bootstrap finished - 5.335 s
⠀
success run static queries - 0.039 s — 1/1 60.03 queries/second
success run page queries - 0.062 s — 3/3 83.41 queries/second
success start webpack server - 1.130 s — 1/1 5.17 pages/second
DONE Compiled successfully in 3133ms 1:16:29 AM
⠀
You can now view pattern-example in the browser.
⠀
http://localhost:3000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
http://localhost:3000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use npm run build
⠀
ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.
The last line gets keeps getting printed with some interval.
This issue should be fixed in more recent docz versions ( > 2.0.0-rc.33 )
Feel free to re-open if it's still happening
Same thing for me. Was trying to set up docz brand new.
[email protected]
Hey @coreylight
Could you please provide an example repo with the problem you're facing ?
Are you also getting : Cannot query field "headings" on type "DoczEntries". ?
Hi @rakannimer, I believe the same issue is happening for me too with gatsby-theme-docz.
Currently on 2.0.0-rc.55 but just updated to 2.0.0-rc.57 and it seems to have the same issue.
Here's the repo to reproduce it: https://github.com/cadbox1/glue-stack/tree/master/website
Fails on yarn build.
Let me know if you need anything else!
It looks like something went wrong in your gatsby setup or dependencies, I'm not sure what exactly.
Is there a reason you need to use docz as a theme in a gatsby app versus using it as a cli ?
I tried your code with a basic docz setup here : https://github.com/cadbox1/glue-stack/pull/89 and both dev and build work as expected
Ah ok @rakannimer I tried again.
I got the same errors but this was because I didn't have a fully-fleshed out .mdx file which seemingly _must_ include a header like #foo.
I thought in previous docz builds that the header was optional but I could be misremembering.
hey @rakannimer thanks so much from your PR! I looked at your changes and experimented a bit and worked out that it was the src property in my doczrc.js file that was causing the problem. Once I removed it the build worked!
Hopefully that helps narrow down the root cause of the problem but for now I'm happy with the workaround.
I wouldn't have figured it out without your PR so thanks again!
https://github.com/cadbox1/glue-stack/pull/90/commits/f1fde20b15d87adcde8016dd077618da3ab28024
Awesome @cadbox1 happy to hear that !
hi @rakannimer I've managed to find the smallest steps to reproduce the issue. There needs to be at least 1 file with a heading for yarn build to work.
https://github.com/cadbox1/docz-entries-issue/commits/master
I ran the standalone docz starter, changed the src (so it ignores the README.md), removed all the markdown files except for the index then removed the headings from the index and the build fails with the DoczEntries issue.
If you add another markdown file with a heading then it works. Looks like this issue is similar https://github.com/doczjs/docz/issues/964
Should we reopen this issue?
Hey @cadbox1
Thanks for providing a repro!
How do you think docz should behave when it doesn't find any markdown(x) files with headings data ?
Use the file name as title and a kebab-cased file path as url ?
Hi @rakannimer, I think it should use the name from the front matter in the file.
It actually does this already with the file that doesn't have headings it's just that if there aren't any headings at all it doesn't compile. Maybe that part of the schema is dropped if no headings are present at all? I recall this being an issue when I played with Gatsby a long time ago: https://github.com/gatsbyjs/gatsby/issues/2392#issuecomment-526637536
I'll be able to move forward here because I'll have other pages with headings but it just tripped me when I was first starting out where I had a single index page without a heading because my heading was in a Heading component.
Hopefully if someone else has this issue they can search and find the workaround.
Workaround: Have at least 1 markdown(x) file with a # heading in it!
@cadbox1 it works! Hope it could get fixed. My current version is 2.3.0-alpha.5
Most helpful comment
Hi @rakannimer, I think it should use the name from the front matter in the file.
It actually does this already with the file that doesn't have headings it's just that if there aren't any headings at all it doesn't compile. Maybe that part of the schema is dropped if no headings are present at all? I recall this being an issue when I played with Gatsby a long time ago: https://github.com/gatsbyjs/gatsby/issues/2392#issuecomment-526637536
I'll be able to move forward here because I'll have other pages with headings but it just tripped me when I was first starting out where I had a single index page without a heading because my heading was in a Heading component.
Hopefully if someone else has this issue they can search and find the workaround.
Workaround: Have at least 1 markdown(x) file with a # heading in it!