getStaticPaths with @prismicio/next (1.3.0+) version

I was updating my project into latest versions and I crossed into following problem:

If I update either @prismicio/next into 1.3.0+ version version or update Next.js from 13.4.3 to 13.4.19 version, getStaticPaths inside subfolder e.g. /project/[slug] won't work locally. I have found latest version, which does not cause any issues and its version 1.2.1 (for prismicio/next).

The funny thing is that, when I manually type address into url for example "localhost:5000/projects/portfolio" it shows the corresponding data from Prismic, but when I am trying to reach the same exact page via from landingPage (home) by pressing button, it just shows 404 page.

I have tried adding some console.logging inside the "getStaticPaths", but nothing is happening there when pressing the button, only when manually writing the path into url it logs something to terminal.

ALSO when building project into production, it generates the path inside "/project/[slug]" as intended and starting project, user is able to go into path via landingPage.

Been kinda stuck on this few days, and have tried to figure it out that whats causing this problem, is it either on Next.js side or something to do with the @prismicio/next library.

As far as I know, Next.js has not changed the way it generates paths for "pages" router on local envinronment?

In development (next dev), getStaticPaths will be called on every request.

I am curious has anyone else crossed following problem, when updating library into (1.3.0+) version as I have tried now pretty much every version from 1.3.0 ==> 1.3.4.

Alright after some more digging I found following versions to be working and not causing any problems for me with the dynamic static paths:

  • @prismicio/next 1.3.4
  • next 13.4.12

And rest of the packages currently:

"dependencies": {
    "@apollo/client": "^3.8.3",
    "@prismicio/client": "^6.8.0",
    "@prismicio/helpers": "^2.3.9",
    "@prismicio/next": "^1.3.4",
    "@prismicio/react": "^2.7.2",
    "@prismicio/slice-simulator-react": "^0.2.3",
    "@types/node": "^20.6.0",
    "@types/react": "^18.2.21",
    "@types/react-dom": "^18.2.7",
    "apollo-link": "^1.2.14",
    "apollo-link-http": "^1.5.17",
    "classnames": "^2.3.2",
    "eslint": "^8.49.0",
    "eslint-config-next": "^13.4.19",
    "graphql": "^15.8.0",
    "html-react-parser": "^4.2.2",
    "init": "^0.1.2",
    "next": "^13.4.12",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "swr": "^2.2.2",
    "typescript": "^5.2.2"
  },
  "devDependencies": {
    "@graphql-codegen/cli": "^5.0.0",
    "@graphql-codegen/client-preset": "^4.1.0",
    "@graphql-codegen/fragment-matcher": "^5.0.0",
    "@prismicio/types": "^0.2.7",
    "@slicemachine/adapter-next": "^0.3.15",
    "@types/node-fetch": "^2.6.4",
    "autoprefixer": "^10.4.15",
    "dotenv": "^16.3.1",
    "node-fetch": "^2.7.0",
    "postcss": "^8.4.29",
    "slice-machine-ui": "^1.13.0",
    "tailwindcss": "^3.3.3",
    "ts-node": "^10.9.1"
  }
1 Like