Hi. I am trying to Next.js app router build but it returns Link resolver error.
What is problem...
- Returns Link resolver error on build
- at type "homepage" and "recruit"
What I am trying...
pnpm run build
with Next.js app router- Using slicemachine
- page types
- homepage: single
- recruit: single
- page: reusable
- newsPost: reusable
- custom types
- category: reusable
- navigation: reusable
- All of type's article is published
pnpm run dev
works correctly
It returns...
> next build
β² Next.js 14.0.4
β Creating an optimized production build
β Compiled successfully
β Linting and checking validity of types
Collecting page data ..A [Error]: [Link resolver error] Unknown type
Declared type: homepage
Expected one of:
- page
- newsPost
- navigation
- category
[Link resolver error] Unknown type
Declared type: recruit
Expected one of:
- page
- newsPost
- navigation
- category
at z.fetch (/Users/kazuto/develop/REPOSITORY_NAME/.next/server/chunks/3519.js:1:11561)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async z.get (/Users/kazuto/develop/REPOSITORY_NAME/.next/server/chunks/3519.js:1:4914)
at async z.dangerouslyGetAll (/Users/kazuto/develop/REPOSITORY_NAME/.next/server/chunks/3519.js:1:5444)
at async z.getAllByTag (/Users/kazuto/develop/REPOSITORY_NAME/.next/server/chunks/3519.js:1:6339)
at async Object.b [as generateStaticParams] (/Users/kazuto/develop/REPOSITORY_NAME/.next/server/app/company/[uid]/page.js:1:7403)
at async buildParams (/Users/kazuto/develop/REPOSITORY_NAME/node_modules/.pnpm/next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:987:36)
at async /Users/kazuto/develop/REPOSITORY_NAME/node_modules/.pnpm/next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1004:33
at async /Users/kazuto/develop/REPOSITORY_NAME/node_modules/.pnpm/next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1134:114
at async Span.traceAsyncFn (/Users/kazuto/develop/REPOSITORY_NAME/node_modules/.pnpm/next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:147:20) {
url: 'https://REPOSITORY_NAME.cdn.prismic.io/api/v2/documents/search?q=%5B%5Bany%28document.tags%2C+%5B%22company%22%5D%29%5D%5D&pageSize=100&ref=ZWwc5BAAACMAyx8S&routes=%5B%7B%22type%22%3A%22newsPost%22%2C%22path%22%3A%22%2Fnews%2Farticle%2F%3Auid%22%7D%2C%7B%22type%22%3A%22page%22%2C%22path%22%3A%22%2F%3Auid%22%7D%2C%7B%22type%22%3A%22homepage%22%2C%22path%22%3A%22%2F%22%7D%2C%7B%22type%22%3A%22recruit%22%2C%22path%22%3A%22%2Frecruit%22%7D%5D',
response: {
type: 'Link resolver error',
message: '[Link resolver error] Unknown type\n' +
'Declared type: homepage\n' +
'Expected one of:\n' +
'- page\n' +
'- newsPost\n' +
'- navigation\n' +
'- category\n' +
'[Link resolver error] Unknown type\n' +
'Declared type: recruit\n' +
'Expected one of:\n' +
'- page\n' +
'- newsPost\n' +
'- navigation\n' +
'- category'
}
}
{"type":"Link resolver error","message":"[Link resolver error] Unknown type\nDeclared type: homepage\nExpected one of:\n- page\n- newsPost\n- navigation\n- category\n[Link resolver error] Unknown type\nDeclared type: recruit\nExpected one of:\n- page\n- newsPost\n- navigation\n- category"}
src/prismicio.ts
const routes: prismic.ClientConfig["routes"] = [
{
type: 'newsPost',
path: "/news/article/:uid",
},
{
type: "page",
path: "/:uid",
},
{
type: "homepage",
path: "/",
},
{
type: "recruit",
path: "/recruit",
},
];
app directory
src/app
βββ [uid]
β βββ page.tsx
β βββ styles.module.css
βββ api
β βββ exit-preview
β β βββ route.ts
β βββ preview
β β βββ route.ts
β βββ revalidate
β βββ route.ts
βββ company
β βββ [uid]
β β βββ page.tsx
β βββ page.tsx
βββ favicon.ico
βββ globals.css
βββ layout.tsx
βββ news
β βββ [page]
β β βββ page.tsx
β βββ article
β β βββ [uid]
β β βββ page.tsx
β βββ category
β β βββ [category]
β β βββ [page]
β β β βββ page.tsx
β β βββ page.tsx
β βββ page.tsx
βββ page.tsx
βββ recruit
β βββ page.tsx
βββ services
β βββ [uid]
β β βββ page.tsx
β βββ page.tsx
βββ slice-simulator
βββ page.tsx
Any idea what I am wrong?
Thank you.