Skip to content
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

Updating gatsby-config to have a single externalLinks element results in the default Instagram link still being rendered #232

Closed
GeekLad opened this issue Jan 20, 2020 · 2 comments · Fixed by #234
Labels
type: bug An issue or pull request relating to a bug

Comments

@GeekLad
Copy link

GeekLad commented Jan 20, 2020

Description

Updating siteMetadata.externalLinks to have a single element results in the default template's Instagram link still being rendered. If you do this while running gatsby develop, it results in a render error. If you kill gatsby develop and re-run, the default template's Instagram link is rendered.

Steps to reproduce

  • Run gatsby develop
  • Update the gatsby-config.js to have a single externalLinks element
  • Observe the error when the page attempts to re-render
  • Kill gatsby develop and re-run

Expected result

The page should only display a single external link.

Actual result

When making the update while running gatsby develop the following error is displayed:

Failed to compile
There was an error in your GraphQL query:

Cannot query field "siteImage" on type "SiteSiteMetadata".

If you don't expect "siteImage" to exist on the type "SiteSiteMetadata" it is most likely a typo.
However, if you expect "siteImage" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "siteImage" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "SiteSiteMetadata":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: D:/dev/geeklad-com/node_modules/@lekoarts/gatsby-theme-minimal-blog/src/hooks/use-site-metadata.tsx

There was an error in your GraphQL query:

Cannot query field "tagsPath" on type "SiteSiteMetadata".

If you don't expect "tagsPath" to exist on the type "SiteSiteMetadata" it is most likely a typo.
However, if you expect "tagsPath" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "tagsPath" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "SiteSiteMetadata":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: D:/dev/geeklad-com/node_modules/@lekoarts/gatsby-theme-minimal-blog/src/hooks/use-site-metadata.tsx

There was an error in your GraphQL query:

Cannot query field "basePath" on type "SiteSiteMetadata".

If you don't expect "basePath" to exist on the type "SiteSiteMetadata" it is most likely a typo.
However, if you expect "basePath" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "basePath" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "SiteSiteMetadata":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: D:/dev/geeklad-com/node_modules/@lekoarts/gatsby-theme-minimal-blog/src/hooks/use-site-metadata.tsx

There was an error in your GraphQL query:

Cannot query field "blogPath" on type "SiteSiteMetadata".

If you don't expect "blogPath" to exist on the type "SiteSiteMetadata" it is most likely a typo.
However, if you expect "blogPath" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "blogPath" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "SiteSiteMetadata":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: D:/dev/geeklad-com/node_modules/@lekoarts/gatsby-theme-minimal-blog/src/hooks/use-site-metadata.tsx

There was an error in your GraphQL query:

Cannot query field "showLineNumbers" on type "SiteSiteMetadata".

If you don't expect "showLineNumbers" to exist on the type "SiteSiteMetadata" it is most likely a typo.
However, if you expect "showLineNumbers" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "showLineNumbers" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "SiteSiteMetadata":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: D:/dev/geeklad-com/node_modules/@lekoarts/gatsby-theme-minimal-blog/src/hooks/use-site-metadata.tsx

If you re-run gatsby develop the page renders, but instead of the single external link, it shows a second external link (the default Instagram link).

Environment


  System:
    OS: Windows 10 10.0.18362
    CPU: (4) x64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
  Binaries:
    Node: 10.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.9.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    gatsby: ^2.13.3 => 2.18.25 
    gatsby-plugin-google-analytics: ^2.1.4 => 2.1.33 
    gatsby-plugin-manifest: ^2.2.3 => 2.2.37 
    gatsby-plugin-netlify: ^2.1.3 => 2.1.31 
    gatsby-plugin-offline: ^2.2.4 => 2.2.10 
    gatsby-plugin-sitemap: ^2.2.19 => 2.2.26 
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.8 => 1.1.8 
@GeekLad GeekLad added the type: bug An issue or pull request relating to a bug label Jan 20, 2020
@shrugs
Copy link

shrugs commented Jan 22, 2020

confirmed one my end. my workaround: just add a second link to any relevant website 😅

@LekoArts
Copy link
Owner

Thanks for the issue!

I did make a breaking change to fix that (it was necessary) as it seems Gatsby has problems merging things in siteMetadata if it's more than a key/string pair. Moving it to the theme options should solve this. I also added some guards in the components so that you can leave it completely empty (both).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants