Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

Description

This PR fixes the GraphQL build error where gatsby-redirect-from plugin queries the slug field on Frontmatter type, which was not defined in the schema.

Cannot query field "slug" on type "Frontmatter".

If you don't expect "slug" to exist on the type "Frontmatter" it is most likely a typo. However, if you expect "slug" 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/gatsby-config, please try a restart of your development server.
- You want to optionally use your field "slug" and right now it is not used anywhere.

It is recommended to explicitly type your GraphQL schema if you want to use optional fields.

Changes:

  • Add slug: String to the Frontmatter type definition in createSchemaCustomization in gatsby-node.js

Notes for Reviewers

The gatsby-redirect-from plugin queries frontmatter { slug } to support redirect functionality. This optional field needed to be explicitly typed in the GraphQL schema to prevent build errors.

Signed commits

  • Yes, I signed my commits.
Original prompt

14s
1m 45s
Run npm install --legacy-peer-deps

[email protected] prepare
husky install

husky - Git hooks installed

added 2854 packages, and audited 2855 packages in 1m

575 packages are looking for funding
run npm fund for details

22 vulnerabilities (10 low, 8 moderate, 4 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues possible (including breaking changes), run:
npm audit fix --force

Fix the following build error:

info Writing GraphQL type definitions to /home/runner/work/layer5/layer5/.cache/schema.gql
success building schema - 1.725s
error There was an error in your GraphQL query:

Cannot query field "slug" on type "Frontmatter".

If you don't expect "slug" to exist on the type "Frontmatter" it is most likely a typo. However, if you expect "slug" 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/gatsby-config, please try a restart of your development server.
- You want to optionally use your field "slug" and right now it is not used anywhere.

It is recommended to explicitly type your GraphQL schema if you want to use optional fields.
not finished createPages - 0.016s
Error: Process completed with exit code 1.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@leecalcote leecalcote marked this pull request as ready for review December 1, 2025 04:40
Copilot AI changed the title [WIP] Fix GraphQL query error for Frontmatter type [gatsby-plugin-feed] Fix GraphQL query error for html field on Mdx type Dec 1, 2025
Copilot AI requested a review from leecalcote December 1, 2025 05:08
@leecalcote
Copy link
Member

@copilot, the firewall rules have been updated. Please proceed.

Copy link
Contributor Author

Copilot AI commented Dec 1, 2025

@copilot, the firewall rules have been updated. Please proceed.

Fixed in 3632986. The build error was caused by the gatsby-redirect-from plugin querying frontmatter { slug }, but this field wasn't defined in the schema. Added slug: String to the Frontmatter type definition in gatsby-node.js.

Copilot AI changed the title [gatsby-plugin-feed] Fix GraphQL query error for html field on Mdx type [gatsby-node] Fix GraphQL query error for slug field on Frontmatter type Dec 1, 2025
@leecalcote leecalcote closed this Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants