#Trigger.dev on NestJS within a monorepo

1 messages · Page 1 of 1 (latest)

astral grove
#

Hey, I am using the latest version of the sdk / nestjs package, and I am having this issue... I am not sure what's causing it.

civic auroraBOT
#

Hi @astral grove. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'm sorry you're experiencing issues with Trigger.dev and NestJS in a monorepo. Based on the knowledge sources, there is a known issue when using NestJS inside Trigger.dev tasks: NestJS has a global exception filter that can swallow all errors and exceptions, preventing Trigger.dev from surfacing them. This can make debugging difficult, as errors inside your tasks may not be visible.

The documentation specifically recommends not using NestJS inside your Trigger.dev tasks. If you need to use NestJS elsewhere in your monorepo, that's fine, but avoid initializing or running NestJS application contexts within your Trigger.dev task definitions. Here’s an example of what to avoid:

export const simplestTask = task({
  id: "nestjs-example",
  run: async (payload) => {
    // This will swallow errors and is not recommended
    const app = await NestFactory.createApplicationContext(AppModule);
    await app.init();
    // ...
  },
});

Recommendation:

  • Do not use NestJS application context or modules inside your Trigger.dev tasks.
  • If you need to share logic, extract it into plain TypeScript modules or services that do not depend on NestJS lifecycle or dependency injection.

If you continue to have issues, please provide more details about the error message or stack trace, or consider reaching out on the Trigger.dev Discord for more targeted help.

For more details, see the documentation: Framework specific issues – NestJS swallows all errors/exceptions.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@astral grove Kapa.ai is still learning and improving, please let me know how I did by reacting below.

pseudo stone
#

The nestjs package is deprecated, it was for v2.

You should follow the quick start guide for v3 to get setup