Replies: 5 comments 5 replies
-
This does appear to happen in canary as well.
|
Beta Was this translation helpful? Give feedback.
-
Looks like there's at least one person facing a similar problem, but it differs slightly in that they weren't using the |
Beta Was this translation helpful? Give feedback.
-
I would like to see the original issue open again. This is definitely a problem when you want to host next.js on Azure App Services that run Windows. I solved the issue by replacing the line during the build time, as you can see below:
However, this is a dirty hack and named pipes should be natively supported by next.js in my opinion. |
Beta Was this translation helpful? Give feedback.
-
Thanks @tiagojsrios, removing |
Beta Was this translation helpful? Give feedback.
-
Ran into this also, and is going to quick hack fix by remove parseint also. Would love to seen this supported / fixed, as it consumed a hole day of work figuring out what the issue was |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
When using
output: "standalone"
in next.config.js, a server.js file is automatically generated. The server.js assumes that the port can only be numeric via the following line:const currentPort = parseInt(process.env.PORT, 10) || 3000
However, when using iisnode to host a Next.js application in Windows Server,
process.env.PORT
is a named pipe (a string). This causes problems where starting the Next server will default to port 3000 instead of using the port provided by iisnode. I'm requesting to allowcurrentPort
to be a string.There have been other libraries that have run into the same problem:
graphql-hive/graphql-yoga#232
I'm also willing to open a PR if needed - just let me know!
Describe the solution you'd like
Instead of generating server.js with
const currentPort = parseInt(process.env.PORT, 10) || 3000
use
const currentPort = process.env.PORT || 3000
From my tests, changing that line allows iisnode to host the application properly.
Describe alternatives you've considered
I've considered using a custom server to deploy with iisnode but I'd prefer to keep using features like automatic static optimization. I also thought of not including
.next/standalone/server.js
in every deploy and keeping a single copy of server.js from a previous build. However, I wasn't sure how often the output of server.js would be changing and would prefer not to constantly check a diff between the newly generated one and the existing one.Beta Was this translation helpful? Give feedback.
All reactions