You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to integrate NovuModule into my existing NestJS application, found that Novu released NestJS feature on 10/10/2024, followed the instructions to integrate NovuModule, but cant import NovuModule from "@novu/framework/nest".
👟 Reproduction steps
Followed the instructions from https://docs.novu.co/quickstart/nestjs, tried to import NovuModule from "@novu/framework/nest", seems Novu did not export NovuModule properly, below are npm dependencies.
Cannot find module '@novu/framework/nest' or its corresponding type declarations.
There are types at '/Users/xx/SourceCode/api/node_modules/@novu/framework/dist/servers/nest.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.ts(2307)
👍 Expected behavior
should be able use nest NovuModule
👎 Actual Behavior with Screenshots
Novu version
Novu framework 2.3.0
npm version
10.8.2
node version
20.17.0
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
we had the same error, this is due to you probably using commonjs modules.
You can use a nestjs middleware with require as a workaround for now or wait until the next release is published.
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import { serve } from '@novu/framework/dist/servers/express';
import workflows from './workflows/index';
@Injectable()
export class NovuMiddleware implements NestMiddleware {
use(req: Request, res: Response, next: NextFunction) {
// FIX: implement NovuModule when cjs is supported:
// Using require instead of import syntax, because novu export is not commonjs
require("@novu/framework/express").serve({
workflows: workflows.map(w => w.workflow),
} as Parameters<typeof serve>['0'])(req, res, next)
}
}
rifont
changed the title
🐛 Bug Report: cant import NovuModule from '@novu/framework/dist/servers/nest';
🐛 Bug Report: Framework - cant import NovuModule from '@novu/framework/dist/servers/nest';
Nov 13, 2024
📜 Description
I am trying to integrate NovuModule into my existing NestJS application, found that Novu released NestJS feature on 10/10/2024, followed the instructions to integrate NovuModule, but cant import NovuModule from "@novu/framework/nest".
👟 Reproduction steps
Followed the instructions from https://docs.novu.co/quickstart/nestjs, tried to import NovuModule from "@novu/framework/nest", seems Novu did not export NovuModule properly, below are npm dependencies.
Cannot find module '@novu/framework/nest' or its corresponding type declarations.
There are types at '/Users/xx/SourceCode/api/node_modules/@novu/framework/dist/servers/nest.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.ts(2307)
👍 Expected behavior
should be able use nest NovuModule
👎 Actual Behavior with Screenshots
Novu version
Novu framework 2.3.0
npm version
10.8.2
node version
20.17.0
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
🏢 Have you read the Contributing Guidelines?
Are you willing to submit PR?
None
The text was updated successfully, but these errors were encountered: