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.

Don't print GraphQL query in the non-page component will not be run error in unused templates

See original GitHub issue

I can not find out how to get rid of these warnings in console log during build time.

warn The GraphQL query in the non-page component "...some path..." will not be run.

Cause of warning is unused template and not GraphQL in non-page component at the first place.

Sice I use headless CMS for sourcing Gatsby I can not rely that CMS user creates always all page types for all Gatsby’s templates. Thus it is common for me that some templates remain unused. I was looking for some “if” condition to prevent this warning but unsuccessfully. So currently my log is filling with this misleading information.

It would be nice to have a way how to say that unused templates can be intentional and do not printing warnings.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
davifantasiacommented, May 28, 2020

This is still a problem.

2reactions
danielcaldascommented, Jun 2, 2020

Steps to reproduce

I’m shadowing queries of a theme.

Expected result

I should not get warnings. The queries should execute for page components.

Actual result

success extract queries from components - 0.359s
warn The GraphQL query in the non-page component "/Users/dcaldas/dev/goodguydaniel.com/node_modules/@lekoarts/gatsby-theme-minimal-blog-core/src/templates/homepage-query.tsx" will not be run.
warn The GraphQL query in the non-page component "/Users/dcaldas/dev/goodguydaniel.com/node_modules/@lekoarts/gatsby-theme-minimal-blog-core/src/templates/post-query.tsx" will not be run.
Exported queries are only executed for Page components. It's possible you're
trying to create pages in your gatsby-node.js and that's failing for some
reason.

Environment

  System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.10.0 - ~/.nvm/versions/node/v12.10.0/bin/node
    Yarn: 1.21.1 - ~/.yarn/bin/yarn
    npm: 6.10.3 - ~/.nvm/versions/node/v12.10.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 83.0.4103.61
    Edge: 83.0.478.44
    Firefox: 76.0.1
    Safari: 13.1
  npmPackages:
    gatsby: ^2.20.36 => 2.22.10
    gatsby-plugin-anchor-links: ^1.1.1 => 1.1.1
    gatsby-plugin-google-analytics: ^2.1.4 => 2.3.2
    gatsby-plugin-manifest: ^2.2.3 => 2.4.9
    gatsby-plugin-offline: ^2.2.4 => 2.2.10
    gatsby-plugin-sitemap: ^2.2.19 => 2.4.3
    gatsby-remark-autolink-headers: ^2.3.3 => 2.3.3
    gatsby-transformer-remark: ^2.8.13 => 2.8.13
  npmGlobalPackages:
    gatsby-cli: 2.12.34
Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - GraphQL query complaints in non-page component ...
The GraphQL query in the non-page component "C:/GitRepos/gatsby-blog-starter/src/templates/blogPost.js" will not be run.
Read more >
Five Common Problems in GraphQL Apps (And How to Fix ...
Schema duplication; Server/client data mismatch; Superfluous database calls; Poor performance; Boilerplate overdose. I'm willing to bet your app ...
Read more >
Frontend testing standards and style guidelines - GitLab Docs
This assumes that implementation details of behavior under test should be covered by that component's individual unit test. There is no strong preference...
Read more >
Top 18 Most Common AngularJS Developer Mistakes - Toptal
Sheer size of the AngularJS can easily lead to many mistakes. In this article you will learn about most common AngularJS developer mistakes...
Read more >
Build a Secure Blog with Gatsby, React, and Netlify
"C:/work/gatsby/gatsby-netlify-okta/src/templates/blog.js” will not be run. Exported queries are only executed for Page components. It's ...
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