question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to connect the magic

See original GitHub issue

Not really sure what is happening here. I am getting errors about queries i don’t really see… I know im doing something wrong but not realy sure what is happening under the hood. This is with markdown but it seems to magically add to my queries in some way that I cant see.

Modifying examples that are provided I have something like this right now

const path = require('path');

exports.createPages = ({ boundActionCreators, graphql }) => {
  console.log('Create Pages');

  const { createPage } = boundActionCreators;

  const mdPageTemplate = path.resolve('src/templates/md.js');

  return graphql(`
    {
      allMarkdownRemark(
        sort: { order: DESC, fields: [frontmatter___date] }
        limit: 1000
      ) {
        edges {
          node {
            excerpt(pruneLength: 250)
            html
            id
            frontmatter {
              date
              path
              title
            }
          }
        }
      }
    }
  `).then(result => {
    if (result.errors) {
      return Promise.reject(result.errors);
    }
    result.data.allMarkdownRemark.edges.forEach(({ node }) => {
      createPage({
        path: node.frontmatter.path,
        component: mdPageTemplate,
        context: {}, // additional data can be passed via context
      });
    });
  });
};

Then the template has something like this:

// eslint-disable-next-line
export const pageQuery = graphql`
  query MarkdownPageByPath($path: String!) {
    markdownRemark(frontmatter: { path: { eq: $path } }) {
      html
      frontmatter {
        date(formatString: "MMMM DD, YYYY")
        path
        title
      }
    }
  }
`;

This produces an error that it cant find the id. Not really sure why. I see the original queries the id but dont know how i can get it to pass said id into this and/or why this is happening when the original example looks like this.

The GraphQL query from /Users/bradennapier/Desktop/Dash OS/IDE/projects/whaleclub-scam/src/templates/md.js failed

        Errors:
          GraphQLError: Cannot read property 'id' of undefined
        Query:
          query MarkdownPageByPath(
  $path: String!
) {
  markdownRemark(frontmatter: {path: {eq: $path}}) {
    html
    frontmatter {
      date(formatString: "MMMM DD, YYYY")
      path
      title
    }
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BrandonSMcommented, Feb 2, 2018

Deleting the node_modules folder and running yarn install && yarn develop again made the blog post show up.

1reaction
KyleAMathewscommented, Nov 14, 2017

You need to remove your node_modules directory and reinstall. If that’s not working — you could also try running npm rebuild sharp.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect an Apple wireless accessory with Mac
Connect an Apple Wireless Keyboard, Magic Mouse, or Magic Trackpad with your Mac · On your Mac, choose Apple menu > System Settings,...
Read more >
Magic Keyboard Bluetooth pairing
Pair your keyboard · Double click the Bluetooth icon in the Windows taskbar. If you can't see the Bluetooth icon, · Select Add...
Read more >
How to Connect Magic Keyboard to a Mac - Lifewire
Tap Settings > Bluetooth > On > and choose your Magic Keyboard from Other Devices. If you've already paired your keyboard with a...
Read more >
How To Connect The Magic Box To Your Car - Help Center
Plug the USB-C cord directly into the Magic Box. · Take the other end of the cord (USB-A) and plug it directly into...
Read more >
7 Simple Practices to Connect With Intuitive Magic
All you need is a little bit of imagination. Surround yourself in a circle of stones, a bubble of light, a shield of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found