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

Unhandled Runtime Error: No content found for <route> #657

Closed
ttwrpz opened this issue Aug 7, 2022 · 2 comments
Closed

Unhandled Runtime Error: No content found for <route> #657

ttwrpz opened this issue Aug 7, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ttwrpz
Copy link

ttwrpz commented Aug 7, 2022

I'm facing problem that pages in the subfolder having error with Unhandled Runtime Error: No content found for <route>. This problem is not affect pages that in the same level as _app.js.

Environment:

OS: Windows 11
Node: v16.16.0
Package Manager: pnpm 7.9.0

Dependencies:

"next": "^12.2.4",
"nextra": "2.0.0-beta.15",
"nextra-theme-docs": "2.0.0-beta.15",
"react": "^18.1.0",
"react-dom": "^18.1.0"

Example for Route /a/test

Folder Structure

pages/
├─ a/
│  ├─ test.mdx
├─ _app.js
├─ index.mdx

Error

Unhandled Runtime Error
Error: No content found for /a/test.

Call Stack
Layout
node_modules\.pnpm\nextra-theme-docs@2.0.0-beta.15_vyccxgqxcnj5vudpssiumaxlme\node_modules\nextra-theme-docs\dist\index.js (2367:0)
renderWithHooks
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (16305:0)
updateFunctionComponent
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (19588:0)
beginWork
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (21601:0)
HTMLUnknownElement.callCallback
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (4164:0)
Object.invokeGuardedCallbackDev
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (4213:0)
invokeGuardedCallback
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (4277:0)
beginWork$1
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (27451:0)
performUnitOfWork
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (26557:0)
workLoopConcurrent
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (26543:0)
renderRootConcurrent
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (26505:0)
performConcurrentWorkOnRoot
node_modules\.pnpm\react-dom@18.2.0_react@18.2.0\node_modules\react-dom\cjs\react-dom.development.js (25738:0)
workLoop
node_modules\.pnpm\scheduler@0.23.0\node_modules\scheduler\cjs\scheduler.development.js (266:0)
flushWork
node_modules\.pnpm\scheduler@0.23.0\node_modules\scheduler\cjs\scheduler.development.js (239:0)
MessagePort.performWorkUntilDeadline
node_modules\.pnpm\scheduler@0.23.0\node_modules\scheduler\cjs\scheduler.development.js (533:0)
@ttwrpz ttwrpz changed the title Unhandled Runtime Error: No content found for XXX Unhandled Runtime Error: No content found for <route> Aug 8, 2022
@ttwrpz
Copy link
Author

ttwrpz commented Aug 9, 2022

Further Investigation

const { route } = useRouter()
const context = nextraPageContext[route]

if (!context) throw new Error(`No content found for ${route}.`)

From example path above: /a/test

Variable route is /a/test, but in nextraPageContext is {"/a\\test":{...}}
So the error was thrown because /a/test is not equal to /a\\test

@dimaMachina
Copy link
Collaborator

thanks for investigation, so helpful, will be fixed in next release 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants