theowenyoung / gatsby-theme-primer-wiki

A Gatsby Theme for Wiki/Docs/Knowledge Base, which using Primer style as the UI theme, can work well with Foam or Obsibian or just markdown files.
https://demo-wiki.owenyoung.com/
MIT License
117 stars 18 forks source link

Error generating sites when reading `inboundReferences` #54

Closed flyinggrizzly closed 2 years ago

flyinggrizzly commented 2 years ago

I've been running into this in a few cases. I've been looking at moving my Obsidian published site over to this, but every time I try to set it up I get the following error when starting the server.

This is happening when using the Obsidian template, and when using the starter, both with my files in place, and with the default demo content present in the starter.

I'm running Node 16.14.0

I'm not particularly familiar with GraphQL, so sorry that I'm not coming with more debug info.

 ERROR #85901  GRAPHQL                                                                                                    

There was an error in your GraphQL query:                                                                                 

Cannot read properties of undefined (reading 'filter')

   1 | query pathToRepoLayoutsnodeModulesgatsbyThemePrimerWikisrcuseNoteGraphDataJs2320115945 {
   2 |   allMdx {
   3 |     nodes {                                                      
   4 |       fields {                                  
   5 |         title                                                       
   6 |         slug                                                                                                       
   7 |       }                                                                                                                                                                                                                                       
>  8 |       inboundReferences {                 
     |       ^                                
   9 |         ... on Mdx {                                                                                               
  10 |           fields {                                                                                                 
  11 |             title                                                                                                  
  12 |             slug                                            
  13 |           }                              
  14 |         }                           
  15 |       }                                                                                                            
  16 |       outboundReferences {
  17 |         ... on Mdx {                                                                                               
  18 |           fields {                              

File path: /Users/user/repo/.layouts/node_modules/gatsby-theme-primer-wiki/src/use-note-graph-data.js
Plugin: none                                                                                                              

  TypeError: Cannot read properties of undefined (reading 'filter')                                                                                                                                                                                  

  - node-model.js:266 LocalNodeModel._query           
    [.layouts]/[gatsby]/src/schema/node-model.js:266:21                                                                   

  - node-model.js:327 LocalNodeModel.findAll                                                                              
    [.layouts]/[gatsby]/src/schema/node-model.js:327:47            

  - node-model.js:599 ContextualNodeModel.findAll
    [.layouts]/[gatsby]/src/schema/node-model.js:599:27                                                                   

  - create-schema-customization.js:57 resolver                                                                            
    [.layouts]/[@theowenyoung]/gatsby-transformer-references/lib/create-schema-customization.js:57:12

  - resolvers.ts:668 resolver                    
    [.layouts]/[gatsby]/src/schema/resolvers.ts:668:20 

  - resolvers.ts:668 wrappedTracingResolver   
    [.layouts]/[gatsby]/src/schema/resolvers.ts:668:20                                                                    

  - Array.map                                                                                                                                                                                                                                        

success run static queries - 0.071s - 4/4 56.55/s                                                                         
success run page queries - 0.010s - 2/2 198.22/s                                                                          
⠀                                                                                                                         
You can now view wiki in the browser.                                                                                     
⠀                                         
  Local:            http://localhost:8000/                                                                                
  On Your Network:  http://192.168.50.195:8000/        
⠀                                                                                                                         
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀                                                         
  Local:            http://localhost:8000/___graphql                       
  On Your Network:  http://192.168.50.195:8000/___graphql                                                                 
⠀                                                                                                                                                                                                                                                    
Note that the development build is not optimized.
To create a production build, use gatsby build
theowenyoung commented 2 years ago

Hi, do you have a link of your repo or minimal reproducible repo?

theowenyoung commented 2 years ago

I have updated the obsidian demo repo's dependences.

Now it works well. Try again!

flyinggrizzly commented 2 years ago

Yup, the dep update fixed it. Thanks!