tjanczuk / iisnode

Hosting node.js applications in IIS on Windows
Other
1.85k stars 587 forks source link

HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002 HTTP reason: Internal Server Error While deploying nuxt app #657

Open warheartvik opened 5 years ago

warheartvik commented 5 years ago

Hello,

Because is a requirement of my team, i'm trying to deploy a nuxt app on IISNode. Since is my first time doing this kind of deployment, I copied my whole project on the IISnode 'www' folder. And setup my web.config file this:

note is pointing to a server.js, which is:

var fs = require('fs') var Nuxt = require('nuxt') var resolve = require('path').resolve

var rootDir = resolve('.') var nuxtConfigFile = resolve(rootDir, 'nuxt.config.js')

var options = {} if (fs.existsSync(nuxtConfigFile)) { options = require(nuxtConfigFile) } if (typeof options.rootDir !== 'string') { options.rootDir = rootDir } options.dev = false // Force production mode (no webpack middleware called)

var nuxt = new Nuxt(options)

new nuxt.Server(nuxt) .listen( process.env.PORT || process.env.npm_package_config_nuxt_port, process.env.HOST || process.env.npm_package_config_nuxt_host )

As can be seen in this previous issue: https://github.com/nuxt/nuxt.js/issues/465

I can provide more info if is needed, any kind of help is well received.

Best regards!

dicabrio commented 5 years ago

<action type="Rewrite" url="server.js"/> we changed the url to server (without .js) because our nuxt instance server was at path: /server/index.js

nathan1658 commented 5 months ago

I followed the official tutorial on deploying the application to IISNode Link

npx nuxi build --preset=iis_node

I got the same error but no idea what's happening. Until I inspect the generated index.js that starts with this line:

if (process.env.PORT.startsWith('\')) { ....

It seems the backslash is missing here. Then I changed it to

if (process.env.PORT.startsWith('\\')) {

and everything works now. Hope it helps.

aligjahed commented 5 months ago

I followed the official tutorial on deploying the application to IISNode Link

npx nuxi build --preset=iis_node

I got the same error but no idea what's happening. Until I inspect the generated index.js that starts with this line:

if (process.env.PORT.startsWith('\')) { ....

It seems the backslash is missing here. Then I changed it to

if (process.env.PORT.startsWith('\\')) {

and everything works now. Hope it helps.

This worked for me. Thanks