Skip to content
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

[Bug] NestJS integration, app/worker hot reloading error #1437

Open
tiberiu89 opened this issue Jun 10, 2024 · 1 comment
Open

[Bug] NestJS integration, app/worker hot reloading error #1437

tiberiu89 opened this issue Jun 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@tiberiu89
Copy link

I'm using nestjs-temporal package, but I assume it would be the same with the nestjs typescript samples provided(if using nest start worker --watch). Everything is good at first run, but after code changes and nestjs reloading, the worker cannot restart, saying address port is already in use(3000).
Does anyone experienced this? Any ideas of a workaround would be appreciated. Manually restarting app is quite annoying.

@tiberiu89 tiberiu89 added the bug Something isn't working label Jun 10, 2024
@tiberiu89
Copy link
Author

Maybe to answer my question, I found one possible alternative
We can split a nestjs app, by creating a separate entry point and main module that would create standalone app(no http server).
Then, edit the nest-cli.json to register this as a separate app. Code and modules can still be shared.

import { NestFactory } from '@nestjs/core';
import { MainRuntimeModule } from './runtime.module';

async function bootstrap() {
  await NestFactory.createApplicationContext(MainRuntimeModule);
}

bootstrap();

We load the module that registers workers only here + everything you need from the main codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant