-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
fix: fixed standalone crashing on Node.js >=17, fixed revalidatePath, revalidateTag #51887
Changes from 13 commits
efa7cd8
88dd26e
65b1cdf
c31ae55
e6a4848
a7ebf68
89a428c
e7cba6d
eb63086
01e6ee0
0450b5c
82260d1
c2628df
c4691f8
00457da
dac524f
eac97fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,28 +102,29 @@ export async function initialize(opts: { | |
}) | ||
} | ||
|
||
let hostname = opts.hostname || 'localhost' | ||
|
||
server.on('listening', async () => { | ||
try { | ||
const addr = server.address() | ||
const port = addr && typeof addr === 'object' ? addr.port : 0 | ||
let resolvedHostname = | ||
addr && typeof addr === 'object' ? addr.address : undefined | ||
|
||
if (!port) { | ||
if (!port || !resolvedHostname) { | ||
console.error(`Invariant failed to detect render worker port`, addr) | ||
process.exit(1) | ||
} | ||
|
||
let hostname = | ||
!opts.hostname || opts.hostname === '0.0.0.0' | ||
? 'localhost' | ||
: opts.hostname | ||
|
||
if (isIPv6(hostname)) { | ||
hostname = hostname === '::' ? '[::1]' : `[${hostname}]` | ||
if (isIPv6(resolvedHostname)) { | ||
resolvedHostname = `[${resolvedHostname}]` | ||
} | ||
|
||
result = { | ||
port, | ||
hostname, | ||
hostname: resolvedHostname, | ||
} | ||
|
||
const app = next({ | ||
...opts, | ||
_routerWorker: opts.workerType === 'router', | ||
|
@@ -143,6 +144,6 @@ export async function initialize(opts: { | |
return reject(err) | ||
} | ||
}) | ||
server.listen(await getFreePort(), '0.0.0.0') | ||
server.listen(await getFreePort(), hostname) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing this to hostname seems like it could cause the issue you're describing, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ijjk no, it won't. I tried it myself. Rather than using the provided hostname for the proxy server, we now use what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a quick way to install this particular change under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michaelangrivera I don't know, maybe try Edit: doesn't seem to be working... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. it doesn't work for me. Is it possible to publish it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michaelangrivera eh, doesn't seem possible without straight up publishing a fork of Next.js, which seems to be quite troublesome... |
||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijjk it is as I described, we call multiple
revalidateTag
(staticGenerationStore.pendingRevalidates
) withawait Promise.all
, but it is not safe to write to one file in a parallel manner.