fastify/help

How to deploy Fastify REST app on windows IIS server?

Jitendragit2019 opened this issue · 3 comments

💬 Request help on deploying fastify rest app on windows IIS server

We have developed a REST API with using Node JS Fastify framework. All works great when we run through local server. But it get several errors when we deploye on IIS server on windows.

[RangeError: "port" argument must be >= 0 and < 65536]

Your Environment

  • node version: 21.7.1
  • fastify version: >=4.20.4
  • os: Windows
  • any other relevant information

I assume you didn't set a port..? Maybe share your code regarding Fastify listen.. I suspect you didn't set a fallback value for your port. Are you maybe using some PORT environment variable?

const portNumber = Number(process.env.PORT || 3000);
fastify.listen({ ...(isNaN(portNumber) ? { path: process.env.PORT } : { port: portNumber }), host: '127.0.0.1' });

Try this.

@Jitendragit2019 I assume you're using iisnode and have set the port as the author described?

Closing as no example provided.