TypeError: Cannot read property 'url' of undefined
See original GitHub issueI created a _document.js to make a Custom Document, per https://nextjs.org/docs/advanced-features/custom-document
I’m getting the error TypeError: Cannot read property 'url' of undefined
Here’s my pages/_document.js:
import Document, { Html, Head, Main, NextScript } from 'next/document'
import basicAuthMiddleware from 'nextjs-basic-auth-middleware'
class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
await basicAuthMiddleware(ctx["req"], ctx["res"], {})
return { ...initialProps }
}
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}
export default MyDocument
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read property 'url' of undefined ...
Set a breakpoint in the console and look at the results being returned. > data.responseData.results [Object, Object, Object, Object].
Read more >What to do about “Cannot read property 'url' of undefined”
You'll need to provide more specific code for further help, but this error means you are trying to access a property on a...
Read more >TypeError: Cannot read property 'url' of undefined - JavaScript
Hi there, I'm getting a TypeError: Cannot read property 'url' of undefined error when trying to render images in one of my components....
Read more >Cannot read property 'url' of undefined · Issue #3837 - GitHub
Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
same with next@10.0.8
same issue with
next@10.0.2