-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Package subpath './server.edge' is not defined by "exports" #48948
Comments
Facing the exact the same issue here, On-demand revalidation doesn't seem to be working anymore since v13.3.0.. Any update on this @timneutkens ? |
I get the same issue |
i can confirm the issue starts with v13.3.2-canary.7 |
Can confirm ,
|
After upgrading to canary
Just in case it helps :) |
Thanks, I've identified the cause and am working on a fix right now. |
Was hoping canary.4 would fix it but it didn't :( |
Currently we invoke the revalidate request directly in the current server when `res.revalidate()` is called. However app needs to be rendered in a separate worker so this results in an error of React. This PR fixes it by sending the request via IPC so the main process will delegate that to the correct render worker. Closes #48948. --------- Co-authored-by: JJ Kasper <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@shuding can you reopen the ticket please, the latest canary.6:
|
Yeah I'm also seeing this @shuding should we open a new issue to track this? $ cat node_modules/react-dom/package.json
{
"name": "react-dom",
"version": "18.2.0",
"description": "React package for working with the DOM.",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",
"directory": "packages/react-dom"
},
"keywords": [
"react"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/facebook/react/issues"
},
"homepage": "https://reactjs.org/",
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.0"
},
"peerDependencies": {
"react": "^18.2.0"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"client.js",
"profiling.js",
"server.js",
"server.browser.js",
"server.node.js",
"test-utils.js",
"cjs/",
"umd/"
],
"exports": {
".": "./index.js",
"./client": "./client.js",
"./server": {
"deno": "./server.browser.js",
"worker": "./server.browser.js",
"browser": "./server.browser.js",
"default": "./server.node.js"
},
"./server.browser": "./server.browser.js",
"./server.node": "./server.node.js",
"./profiling": "./profiling.js",
"./test-utils": "./test-utils.js",
"./package.json": "./package.json"
},
"browser": {
"./server.js": "./server.browser.js"
},
"browserify": {
"transform": [
"loose-envify"
]
}
} |
@karlhorky Can you open a ticket please? I think it warrants a new one since it's different than the original ticket. Thanks. |
Right - it is not the same as the original issue - it's the same error message that you posted in your comment above and @LotharVM posted in their comment. |
@shuding here's a repro, seems like it's caused by custom servers: CodeSandbox Demo (start server using Changes to reproduction template:
// server.mjs
import { createServer } from "node:http";
import { parse } from "node:url";
import next from "next";
const dev = process.env.NODE_ENV !== "production";
const hostname = "localhost";
const port = 3000;
const app = next({ dev, hostname, port });
const handle = app.getRequestHandler();
app.prepare().then(() => {
createServer(async (req, res) => {
try {
await handle(req, res, parse(req.url, true));
} catch (err) {
console.error("Error occurred handling", req.url, err);
res.statusCode = 500;
res.end("internal server error");
}
})
.once("error", (err) => {
console.error(err);
process.exit(1);
})
.listen(port, () => {
console.log(`> Ready on http://${hostname}:${port}`);
});
}); |
Fixes #48948 ([repro](#48948 (comment))). When running inside a custom server with app dir, we should always opt into the prebundled React with correct channels. Thanks @karlhorky for help testing it! Fixes #49169 too. --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
I can confirm CodeSandbox: https://codesandbox.io/p/sandbox/quirky-bell-o5tl8l?file=%2Fserver.mjs |
Seeing this error with a |
Have same error (for [email protected]) - Package subpath './server.edge' is not defined by "exports" - for On-demand Revalidation using res.revalidate([url]) |
Also still facing this issue with 13.4.0:
|
Running into the same issue on |
I had this issue on Removing |
the error persists for in 13.4.2, both local and self-hosted. Do we reopen the ticket @shuding or create a new one? |
@jwalcher opening a new one with a minimal reproduction repo will definitely help, thanks! |
I tried around a bit, and in my current setup the error only appears when the revalidation path gets rewritten by middleware. However, I am still calling res.revalidate from api route instead of using route handler in app directory. If the error persists after complete migration, I will post a new report. Thanks! |
Whoever is still following this: The new @shuding: I have opened an issue #49955 reporting the problems with Minimal code is at https://github.com/jwalcher/revalidation |
This removes the previous handling for the prebundled react env we were setting in favor of vercel/vercel#9974 We need to wait to land this until vercel/vercel#9974 has been rolled Fixes: #49169 Fixes: #49753 x-ref: #48948
@shuding Please could someone take another look at this, perhaps through the issue #50464 The |
This removes the previous handling for the prebundled react env we were setting in favor of vercel/vercel#9974 We need to wait to land this until vercel/vercel#9974 has been rolled Fixes: vercel#49169 Fixes: vercel#49753 x-ref: vercel#48948
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://github.com/medonat/nextjs-revalidate-test
To Reproduce
Describe the Bug
ISR does not work. Stale data is displayed after calling revalidate.
Error in console:
TypeError: Cannot set properties of undefined (setting 'current') at ue (C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\compiled\react-dom\cjs\react-dom-server.edge.production.min.js:113:42) at C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\compiled\react-dom\cjs\react-dom-server.edge.production.min.js:151:127 at new Promise (<anonymous>) at Object.exports.renderToReadableStream (C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\compiled\react-dom\cjs\react-dom-server.edge.production.min.js:151:53) at C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\server\node-web-streams-helper.js:195:117 at NextTracerImpl.trace (C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\server\lib\trace\tracer.js:86:20) at renderToInitialStream (C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\server\node-web-streams-helper.js:195:37) at C:\Users\daniel.hufler\Documents\code\revalidatetest\node_modules\next\dist\server\app-render\app-render.js:918:92
Expected Behavior
Revalidate should work like it did in previous versions (e.g. 13.3.0)
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
next start
The text was updated successfully, but these errors were encountered: