You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
react-dev-overlay does not work as expected when it is run with basePath because it sends a request to the /__nextjs_original-stack-frame and /__nextjs_launch-editor paths. however, when basePath is active, requests get 404 error because these paths are not actually available.
I have resolved my problem temporarily by creating a custom server with the following method.
constexpress=require('express');constnext=require('next').default;constport=parseInt(process.env.PORT,10)||3000;constnextServer=next({dir: '.',dev: process.env.NODE_ENV!=='production',});consthandler=nextServer.getRequestHandler();constapp=express();nextServer.prepare().then(()=>{app.use((req,res)=>{if(req.originalUrl.startsWith('/__nextjs_original-stack-frame')||req.originalUrl.startsWith('/__nextjs_launch-editor')){req.url='/blog'+req.originalUrl;}returnhandler(req,res);});app.listen(port,(err)=>{if(err){throwerr;}console.log(`> Ready on port ${port} `);});});
The text was updated successfully, but these errors were encountered:
This fixes the `basePath` not being used when making requests for the `react-dev-overlay`. We might want to pass down the `basePath` to the overlay instead of relying on the `process.env` injection although may be fine this way, will defer to @Timer for preferred way to pass this value to the dev-overlay
Closes: #14470
This fixes the `basePath` not being used when making requests for the `react-dev-overlay`. We might want to pass down the `basePath` to the overlay instead of relying on the `process.env` injection although may be fine this way, will defer to @Timer for preferred way to pass this value to the dev-overlay
Closes: vercel#14470
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 30, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
Describe the bug
react-dev-overlay does not work as expected when it is run with
basePath
because it sends a request to the/__nextjs_original-stack-frame
and/__nextjs_launch-editor
paths. however, when basePath is active, requests get 404 error because these paths are not actually available.next.js/packages/react-dev-overlay/src/middleware.ts
Line 83 in 7f6c6f0
next.js/packages/react-dev-overlay/src/middleware.ts
Line 199 in 7f6c6f0
next.js/packages/react-dev-overlay/src/internal/helpers/stack-frame.ts
Line 56 in 7f6c6f0
next.js/packages/react-dev-overlay/src/internal/container/RuntimeError.tsx
Line 27 in 86160a5
next.js/packages/react-dev-overlay/src/internal/components/CodeFrame/CodeFrame.tsx
Line 49 in 86160a5
To Reproduce
next.config.js
pages/index.js
Expected behavior
System information
Additional context
I have resolved my problem temporarily by creating a custom server with the following method.
The text was updated successfully, but these errors were encountered: