NestJS & Heroku - Connecting to the gateway requires enabling the VPN

Viewed 99
async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.useWebSocketAdapter(new GatewayAdapter(app));

  app.use(cookieParser());
  app.use(helmet());

  await app.listen(process.env.PORT || 8080);
}

bootstrap();
@WebSocketGateway({
  namespace: 'chat'
})
export class ChatGateway {}

Connecting to the backend and calling APIs work fine, but connecting to the websocket requires enabling the VPN. After enabling the VPN, a connection will be established. This issue only occurs when the app is deployed to Heroku while it works fine on localhost.

1 Answers

May be its a heroku's free tier limitation. Try another platform like netlify.

Related