rsnext/errors/conflicting-ssg-paths.md
Rich Haines 138361208c
Fixed duplicate data fetching overview page + links (#33774)
This PR removes the duplicate overview link for data fetching, and fixes the corresponding links

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-29 02:52:40 +00:00

1.5 KiB

Conflicting SSG Paths

Why This Error Occurred

In your getStaticPaths function for one of your pages you returned conflicting paths. All page paths must be unique and duplicates are not allowed.

Possible Ways to Fix It

Remove any conflicting paths shown in the error message and only return them from one getStaticPaths.

Example conflicting paths:

// pages/hello/world.js
export default function Hello() {
  return 'hello world!'
}

// pages/[...catchAll].js
export const getStaticProps = () => ({ props: {} })

export const getStaticPaths = () => ({
  paths: [
    // this conflicts with the /hello/world.js page, remove to resolve error
    '/hello/world',
    '/another',
  ],
  fallback: false,
})

export default function CatchAll() {
  return 'Catch-all page'
}

Example conflicting paths:

// pages/blog/[slug].js
export const getStaticPaths = () => ({
  paths: ['/blog/conflicting', '/blog/another'],
  fallback: false,
})

export default function Blog() {
  return 'Blog!'
}

// pages/[...catchAll].js
export const getStaticProps = () => ({ props: {} })

export const getStaticPaths = () => ({
  paths: [
    // this conflicts with the /blog/conflicting path above, remove to resolve error
    '/blog/conflicting',
    '/another',
  ],
  fallback: false,
})

export default function CatchAll() {
  return 'Catch-all page'
}