GithubHelp home page GithubHelp logo

kyle-mccarthy / nest-next Goto Github PK

View Code? Open in Web Editor NEW
636.0 14.0 91.0 293 KB

Render Module to add Nextjs support for Nestjs

License: MIT License

JavaScript 4.84% TypeScript 91.85% Shell 2.06% Dockerfile 1.25%
nextjs nestjs

nest-next's Introduction

Nest-Next

Render Module to add Nextjs support for Nestjs.

npm PRs Welcome GitHub license

nest-next provides a nestjs module to integrate next.js into a nest.js application, it allows the rendering of next.js pages via nestjs controllers and providing initial props to the page as well.

Table of Contents

Installation

yarn add nest-next

# or

npm install nest-next

Peer Dependencies

  • react
  • react-dom
  • next

if you are using next.js with typescript which most likely is the case, you will need to also install the typescript types for react and react-dom.

Usage

Import the RenderModule into your application's root module and call the forRootAsync method.

import { Module } from '@nestjs/common';
import Next from 'next';
import { RenderModule } from 'nest-next';

@Module({
  imports: [
    RenderModule.forRootAsync(Next({ dev: process.env.NODE_ENV !== 'production' })),
    ...
  ],
  ...
})
export class AppModule {}

Configuration

The RenderModule accepts configuration options as the second argument in the forRootAsync method.

interface RenderOptions {
  viewsDir: null | string;
  dev: boolean;
}

Views/Pages Folder

By default the the renderer will serve pages from the /pages/views dir. Due to limitations with Next, the /pages directory is not configurable, but the directory within the /pages directory is configurable.

The viewsDir option determines the folder inside of pages to render from. By default the value is /views but this can be changed or set to null to render from the root of pages.

Dev Mode

By default the dev mode will be set to true unless the option is overwritten. Currently the dev mode determines how the errors should be serialized before being sent to next.

tsconfig.json

Next 9 added built-in zero-config typescript support. This change is great in general, but next requires specific settings in the tsconfig which are incompatible with what are needed for the server. However, these settings can easily be overridden in the tsconfig.server.json file.

If you are having issues with unexpected tokens, files not emitting when building for production, warnings about allowJs and declaration not being used together, and other typescript related errors; see the tsconfig.server.json file in the example project for the full config.

Pass-through 404s

Instead of having Nest handle the response for requests that 404, they can be forwarded to Next's request handler.

RenderModule.forRootAsync(
  Next({
    dev: process.env.NODE_ENV !== 'production',
    dir: resolve(__dirname, '..'),
  }),
  { passthrough404: true, viewsDir: null },
),

See this discussion for more context.

Rendering Pages

The RenderModule overrides the Express/Fastify render. To render a page in your controller import the Render decorator from @nestjs/common and add it to the method that will render the page. The path for the page is relative to the /pages directory.

import { Controller, Get, Render } from '@nestjs/common';

@Controller()
export class AppController {
  @Get()
  @Render('Index')
  public index() {
    // initial props
    return {
      title: 'Next with Nest',
    };
  }
}

Additionally, the render function is made available on the res object.

@Controller()
export class AppController {
  @Get()
  public index(@Res() res: RenderableResponse) {
    res.render('Index', {
      title: 'Next with Nest',
    });
  }
}

The render function takes in the view, as well as the initial props passed to the page.

render = (view: string, initialProps?: any) => any;

Rendering the initial props

The initial props sent to the next.js view page can be accessed from the context's query method inside the getInitialProps method.

import { NextPage, NextPageContext } from 'next';

// The component's props type
type PageProps = {
  title: string;
};

// extending the default next context type
type PageContext = NextPageContext & {
  query: PageProps;
};

// react component
const Page: NextPage<PageProps> = ({ title }) => {
  return (
    <div>
      <h1>{title}</h1>
    </div>
  );
};

// assigning the initial props to the component's props
Page.getInitialProps = (ctx: PageContext) => {
  return {
    title: ctx.query.title,
  };
};

export default Page;

Handling Errors

By default, errors will be handled and rendered with next's error renderer, which uses the customizable _error page. Additionally, errors can be intercepted by setting your own error handler.

Custom error handler

A custom error handler can be set to override or enhance the default behavior. This can be used for things such as logging the error or rendering a different response.

In your custom error handler you have the option of just intercepting and inspecting the error, or sending your own response. If a response is sent from the error handler, the request is considered done and the error won't be forwarded to next's error renderer. If a response is not sent in the error handler, after the handler returns the error is forwarded to the error renderer. See the request flow below for visual explanation.

ErrorHandler Typedef
export type ErrorHandler = (
  err: any,
  req: any,
  res: any,
  pathname: any,
  query: ParsedUrlQuery,
) => Promise<any>;
Setting ErrorHandler

You can set the error handler by getting the RenderService from nest's container.

// in main.ts file after registering the RenderModule

const main() => {
  ...

  // get the RenderService
  const service = server.get(RenderService);

  service.setErrorHandler(async (err, req, res) => {
    // send JSON response
    res.send(err.response);
  });

  ...
}
Error Flow (Diagram)

The image is linked to a larger version

error filter sequence diagram

Examples folder structure

Fully setup projects can be viewed in the examples folder

Basic Setup

Next renders pages from the pages directory. The Nest source code can remain in the default /src folder

/src
  /main.ts
  /app.module.ts
  /app.controller.ts
/pages
  /views
    /Index.jsx
/components
  ...
babel.config.js
next.config.js
nodemon.json
tsconfig.json
tsconfig.server.json

Monorepo

Next renders pages from the pages directory in the "ui" subproject. The Nest project is in the "server" folder. In order to make the properties type safe between the "ui" and "server" projects, there is a folder called "dto" outside of both projects. Changes in it during "dev" runs trigger recompilation of both projects.

/server
  /src
    /main.ts
    /app.module.ts
    /app.controller.ts
  nodemon.json
  tsconfig.json
  ...
/ui
  /pages
    /index.tsx
    /about.tsx
  next-env.d.ts
  tsconfig.json
  ...
/dto
  /src
    /AboutPage.ts
    /IndexPage.ts
  package.json

To run this project, the "ui" and "server" project must be built, in any order. The "dto" project will be implicitly built by the "server" project. After both of those builds, the "server" project can be started in either dev or production mode.

It is important that "ui" references to "dto" refer to the TypeScript files (.ts files in the "src" folder), and NOT the declaration files (.d.ts files in the "dist" folder), due to how Next not being compiled in the same fashion as the server.

Known issues

Currently Next "catch all routes" pages do not work correctly. See issue #101 for details.

Contributing

To contribute make sure your changes pass the test suite. To run test suite docker, docker-compose are required. Run npm run test to run tests. Playwright will be installed with required packages. To run tests in Next development mode run npm run test-dev. You can also specify NODE_VERSION and major NEXT_VERSION variables to run tests in specific environments.

License

MIT License

Copyright (c) 2018-present Kyle McCarthy

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

nest-next's People

Contributors

amir-arad avatar boenrobot avatar frux avatar ixahmedxi avatar kyle-mccarthy avatar notherdev avatar sergioutama avatar xilel avatar yakovlev-alexey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nest-next's Issues

Doc clarifications

As on Next 9, typescript is automatically supported, but the file system routing must be disabled.

But why though? What is the effect if one doesn't do that?

I'm early into a project, where the client and server folders are separate and the server takes the client folder, which allows them to have different settings.

I haven't done this setting and my "hello world" level app seems to work fine, so what are the consequences if it is missing?

The .babelrc file must be edited as well.

I also don't have a .babelrc at the server or client either.

Argument of type 'import' is not assignable to parameter

Hi there, I think the plugin has some problems with type checking. I copy the example code and it produce the error:

D:\Work\example\node_modules\ts-node\src\index.ts:245 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: src/main.ts:16:29 - error TS2345: Argument of type 'import("D:/Work/example/node_modules/next/dist/next-server/server/next-server").default' is not assignable to parameter of type 'import("D:/Work/example/node_modules/next-server/dist/server/next-server").default'. renderer.register(server, app);

Remove the use of this.app.useGlobalFilters, Warning RendererService is a singleton

Hello, thank you for this lib,

Actually, each route is binded to the renderer, It would be interesting to to be able to configure the url to handle via next and others via nest.
Trying to make an ajax request from browser to server ends in a "Not implemented" response.

Tell me if I am wrong, the renderer service is a singleton as the nest js module specification says. When an incoming request happens, you store the request and the response on the singleton this.service.next(req, res). But this request and response might be replaced by an other request...

seperate API routes and client routes?

Hey there,
I'm new to nest/next but would like to use them together, where nest serves all /api/ routes and next serves all client routes (ie all GET requests that aren't prefixed with/api/).

It seems like with this plugin nest tries to handle all the routes. How can I configure the routing to send all non-/api/ GET's to next and everything else to nest?

_app file

Unfortunately the package does not work in combination with _app. Without the file "_app" all pages of the app are displayed, but as soon as the file is contained in the pages folder, an empty page is displayed. 😞

Thank you

Nest-next npm package contain unnecessary files

изображение
Npm package contain allot of unnecessary files like

  • example directory
  • .github directory
  • eslint.js
  • changes.md
  • .prittierrrc
    We probably can add this files to .npmignore.
    Nest-next version: 9.1.0

error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'

Hey!

Thank you for sharing the code.
I got an error when I upgraded the version of next to 9.0.

error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'

This should be due to the new feature zero-config typescript support of next 9.0.

Now, the absence of either declaration and isolatedModules will cause errors, and the two options conflict with each other.

Do you have similar problems? Is there a solution?

Thanks!

ViewsDir (pages) needs to be in the same place where server is ?

Hi,

I am using NX (nrwl nx), I have both applications (server and ui) configured to be built in the following directory

/dist
  /apps
    /ui
     ... This contains the cache static directories (i.e. what is normally in .next)

   /server
     main.js
       ... etc etc

I suppose that this configuration isn't supported right ? I mean the viewsdir you state that you can't change the pages directory just the views.

My question, i suppose, is, can this library force a basedir to be used - which in my case would be /dist/apps/ui (where static / pages is found) - or even load it relative from the server directory.

By the way - great library!

Cant start the app

Hi there i am having this error when compiling:

Argument of type 'INestApplication & INestExpressApplication' is not assignable to parameter of type 'INestApplication'.
Property 'enableShutdownHooks' is missing in type 'INestApplication & INestExpressApplication' but required in type 'INestApplication'.

this is my code:

`import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { HttpExceptionFilter } from './shared/filters/http-exception.filter';
import { RenderModule } from 'nest-next';
import Next from 'next';
const dev = AppModule.isDev;

declare const module: any;

async function bootstrap() {
const nextServer = Next({ dev });

await nextServer.prepare();

const app = await NestFactory.create(AppModule);
const renderer = app.get(RenderModule);
renderer.register(app, nextServer); // here is the error
const hostDomain = AppModule.isDev ? `${AppModule.host}:${AppModule.port}` : AppModule.host;

const swaggerOptions = new DocumentBuilder()
    .setTitle('Nest MEAN')
    .setDescription('API Documentation')
    .setVersion('1.0.0')
    .setHost(hostDomain.split('//')[1])
    .setSchemes(AppModule.isDev ? 'http' : 'https')
    .setBasePath('/api')
    .addBearerAuth('Authorization', 'header')
    .build();

const swaggerDoc = SwaggerModule.createDocument(app, swaggerOptions);

SwaggerModule.setup('/api/docs', app, swaggerDoc, {
    swaggerUrl: `${hostDomain}/api/docs-json`,
    explorer: true,
    swaggerOptions: {
        docExpansion: 'list',
        filter: true,
        showRequestDuration: true,
    },
});

if (module.hot) {
    module.hot.accept();
    module.hot.dispose(() => app.close());
}

app.setGlobalPrefix('api');
app.useGlobalFilters(new HttpExceptionFilter());

await app.listen(AppModule.port);

}

bootstrap();
`

Nested routes

I tried many times but didn't find solution about nested routes width this module.
Example: i want to set router like /auth/success/ where success - is another component dependents from route pass
`






`

Application is not started with RenderModule import

Describe the bug
Nest could not find RenderModule element (this provider does not exist in the current context)

Expected behavior
Application starts

Version

  • next.js: 9.1.6
  • nest: 6.7.2
  • nest-next: 9.1.1

Additional context
Using the configuration of monorepo in the examples here.

Question: how to use with supertest

  console.log node_modules/next/dist/build/output/log.js:1
    info  - Using external babel configuration from /home/ilya/WebstormProjects/timesheet/app/src/client/.babelrc

  console.log node_modules/next/dist/build/output/log.js:1
    event - compiled successfully


TypeError: Cannot set property 'render' of undefined

    at RenderService.bindHttpServer (/home/ilya/WebstormProjects/timesheet/app/node_modules/nest-next/dist/render.service.js:79:23)
    at Function.init (/home/ilya/WebstormProjects/timesheet/app/node_modules/nest-next/dist/render.service.js:19:14)
    at InstanceWrapper.useFactory [as metatype] (/home/ilya/WebstormProjects/timesheet/app/node_modules/nest-next/dist/render.module.js:45:67)
    at Injector.instantiateClass (/home/ilya/WebstormProjects/timesheet/app/node_modules/@nestjs/core/injector/injector.js:293:55)
    at callback (/home/ilya/WebstormProjects/timesheet/app/node_modules/@nestjs/core/injector/injector.js:77:41)
    at Injector.resolveConstructorParams (/home/ilya/WebstormProjects/timesheet/app/node_modules/@nestjs/core/injector/injector.js:118:24)
    at Injector.loadInstance (/home/ilya/WebstormProjects/timesheet/app/node_modules/@nestjs/core/injector/injector.js:81:9)
    at Injector.loadProvider (/home/ilya/WebstormProjects/timesheet/app/node_modules/@nestjs/core/injector/injector.js:38:9)
    at async Promise.all (index 3)
    at InstanceLoader.createInstancesOfProviders (/home/ilya/WebstormProjects/timesheet/app/node_modules/@nestjs/core/injector/instance-loader.js:43:9)

Caching

Hi,

is there an example for the cache of nextjs pages with this module?
I couldn't find one in the example folder?
Thanks a lot 😃

Monorepo example production build always send 404 page

Describe the bug
I have tried to use monorepo example. It's work fine in development, but production build always send 404 page. It's don't matter what page you ask (index or about).

Expected behavior
Render page what set in @Render decorator.

To Reproduce

Repository URL: https://github.com/kyle-mccarthy/nest-next/tree/master/examples/monorepo

  1. In server directory: yarn install && yarn build
  2. In ui directory: yarn install && yarn build
  3. In server directory: yarn start
  4. Open in browser http://127.0.0.1:3000

Version

  • next.js: 9.1.6
  • nest: 6.10.12
  • nest-next: 9.1.0

Requests stuck in a pending state when using a Interceptor and node 14

// AppModule.ts

@Module({
  imports: [
    RenderModule.forRootAsync(
      Next({
        dev: process.env.NODE_ENV !== 'production',
        dir: path.resolve(__dirname, '../..'),
      }),
    ),
  ],
  controllers: [IndexController]
})
export class AppModule {}
// controllers/IndexController.ts

@Controller()
export class IndexController {
  @UseInterceptors(new FormatResponse('Index'))
  @Get('/')
  public get(): void {}
}
// interceptors/FormatResponse.ts

@Injectable()
export class FormatResponse implements NestInterceptor {
  public constructor(private readonly pageFileName: string) {}

  public intercept(
    context: ExecutionContext,
    next: CallHandler,
  ): Observable<unknown> {
    const response: Response = context.switchToHttp().getResponse();

    return next
      .handle()
      .pipe(map((payload) => response.render(this.pageFileName, payload)));
  }
}

After a request to the address http://localhost:3000/ the server serves all files except one. This file gets stuck in "pending" status. IMPORTANT! The bug is only seen in 14+ versions of node.js. There is no error in version 12:

image

Request stuck when using hmr

The first request to localhost:3000 works correctly. But after modifying any of the files and rebuilding using webpack hmr, the page stops responding. The request stuck in the "pending" status

webpack.config.js

const webpack = require('webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');

module.exports = {
  entry: ['webpack/hot/poll?100', './src/server/main.ts'],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'server.js',
  },
  watch: true,
  target: 'node',
  externals: [
    nodeExternals({
      allowlist: ['webpack/hot/poll?100'],
    }),
  ],
  module: {
    rules: [
      {
        test: /.tsx?$/,
        loader: 'ts-loader',
        exclude: /node_modules/,
      },
    ],
  },
  mode: 'development',
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new RunScriptWebpackPlugin({
      name: 'server.js',
    }),
  ],
};

IndexController:

import { Controller, Get, Render } from '@nestjs/common';

@Controller()
export class IndexController {
  @Get('/')
  @Render('Index')
  public get(): void {}
}

Server errors result in the _error page displaying a 404 and the original err is missing.

I've noticed this line in render.filter: https://github.com/kyle-mccarthy/nest-next/blame/master/lib/render.filter.ts#L28. If err has a property response, it tries to render the request normally rather than using the error renderer. Is there a reason for this?

I've noticed it's pretty common for server errors to have this property set, and it causes these server errors to show up as seemingly inexplicable 404s with the original error lost. For example, if I'm using a simple global guard to ensure the current request is authenticated, and the request is not authenticated, Nest throws a custom exception that results in a 403, and this error object has response populated, and this causes the described problem.

Example guard:

import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'
import { Request } from 'express'
import { Observable } from 'rxjs'

@Injectable()
export class AuthenticatedGuard implements CanActivate {
  canActivate(
    context: ExecutionContext
  ): boolean | Promise<boolean> | Observable<boolean> {
    const req = context.switchToHttp().getRequest<Request>()

    return req.isAuthenticated() // this is added by passport. if you don't have passport, you can synthesize the error conditions with return false instead.
  }
}

In your server's main.ts, simply add server.useGlobalGuards(new AuthenticatedGuard()). Visiting any URL should manifest a 404.

Other examples: When an axios request generates an error, the err object also has a response property.

In some cases you can work around this issue by clearing the response property, assuming you can intercept the error before it passes on to the render.filter, but that's not always possible.

Different next/next-server versions cause TS2345 for renderer.register

Describe the bug
RenderModule is using Server from next-server.
Typescript doesn't accept the second paramter of this call: renderer.register(server, app);
This is the erorr that comes up when compiling:

TSError: ⨯ Unable to compile TypeScript:
src/main.ts(16,29): error TS2345: Argument of type 'import("my-project-folder/node_modules/next/dist/next-server/server/next-server").default' is not assignable to parameter of type 'import("my-project-folder/node_modules/next-serve
r/dist/server/next-server").default'.
  Types have separate declarations of a private property 'compression'.

Expected behavior
RenderModule should use Server from next;
See examlple/ in this repo, it's trying to pass Server app created by Next call which comes from import Next from 'next'; but RenderModule is using next-server and those types are incompatible.

To Reproduce

Repository URL: https://github.com/kyle-mccarthy/nest-next/tree/12651f7d7bcb5b9b76f3384ff323ca920bad754f/example

Version

Additional context
See

import Server from 'next-server';

Please read: I have found that the issue is that next was configured to use ^9.0.6. However [email protected], comes with [email protected] and causes this error. It is questionable if this is a bug related to nest-next. My temporary fix is to lock both next and next-server to 9.0.5.

Monorepo initial props not working

Describe the bug
After cloning the repository, I've start the monorepo's dev server. Server works fine, but initial props not working. This is just example code in here.

// server/src/app.controller.ts
@Controller()
export class AppController {
  @Render('index')
  @Get()
  public index(): IndexProps {
    return { message: 'from server' }; // If controller's method return message,
  }
}

// ui/pages/index.ts
IndexPage.getInitialProps = async context => {
  if (context.req) {
    return (context.query as unknown) as IndexProps; // when the first server side rendering occurs, I think I can receive  'from server' message, but not working
  }
  return { message: 'from client' };
};

Expected behavior
Receive the initial props in ui component's getInitialProps.

To Reproduce

Repository URL:

Version

  • next.js: 9.3.5
  • nest: 6.11.11
  • nest-next: 9.2.0

Additional context
Add any other context about the problem here.

React Routing

I usually like to do my research and spend a lot of time doing so before reaching out for help but I'm at a dead end. I must be having tunnel vision at this point but either way here goes.

I understand the reason for handling routes in Nest and routing them to Next but I'm actually looking for Next to handle anything not defined in Nest. I don't know if this is the correct use case but here's an example none the less.

In pages/, I create a file called index.tsx and in nest I add to the AppController a Get('') and Render('Index'). This loads on localhost:3000. In this index.tsx file, I create a link to redirect the user to a new page called Profile (). Clicking on this link for Profile, it successfully routes the user however when I refresh, Nest kicks in and throws an error.

Is there a solution for this?

In conclusion, if I go to /asadd, a non existent route in Nest, I would like to see the Next 404 error page and not the Nest stack trace page.

Example for Next.js 9

Next.js 9 overrides tsconfig.json, makes it difficult to get it working. Is it possible to provide an example for 9?

Documentation and package.json Issues

In my terminal, I tried to start the example app within the example folder. I tried to start it by following the ReadMe by running yarn. I got an error about Nest-Next missing. I then run yarn add nest-next. I tried running yarn again. That worked, but when I tried to run yarn dev. I then get another error for /bin/sh: nodemon: command not found. I then try adding yarn add nodemon --save-dev. I tried running yarn and finally I didn't get any errors. I was then able to run yarn dev.

When I was getting ready to submit a pull request, I noticed yalc. I'm not familiar with yalc so then I noticed that I needed to add it globally with yarn global add yalc. Adding yalc didn't seem to fix the issues though. What is the globally installed app requirements before running your project with the instructions you provided? I know yarn for sure.

`experimental.baseUrl` configuration

Describe the bug
I am trying to get nest-next working with my next app which is part of a larger solution.
Any request that hits my load balancer with the prefix of /drivers get forwarded to the next app.
Using nextjs v9.4.4 I am able to set the experimental.baseUrl configuration option in next.config.js to /drivers and this works fine.
When using next-nest the browser keeps trying to find the static bundles in /_next/static/... instead of /drivers/_next/static/..

Expected behavior
I would expect the experimental.baseUrl property to work.

Version

  • next.js: 9.4.4
  • nest: 7.1.1
  • nest-next: 9.2.0

Additional context
I understand the configuration flag in next is marked as experimental, but it is just a configuration option that works in 9.4.4, but doesn't when I am using nest-next.

app.module.ts:

@Module({
  imports: [
    RenderModule.forRootAsync(
      Next({
        dev: process.env.NODE_ENV !== "production",
        conf: {
          experimental: { baseUrl: "/drivers" }
        }
      }),
      {
        viewsDir: "/"
      }
    )
  ],
  controllers: [AppController]
})
export class AppModule {}

Next server type issue(s)

Describe the bug

TS2345: Argument of type 'import(".../node_modules/next/dist/next-server/server/next-server").default' is not assignable to parameter of type 'import(".../node_modules/nest-next/node_modules/next/dist/next-server/server/next-server").default'. Types have separate declarations of a private property 'compression'.

For some reason Nest-Next implements a static version of Next (in a private node_modules) rather than using the installed peer. But that doesn't appear to be the root of the issue, since the two types actually have the same type definition for "compression":

private compression?;

Not sure what the core issue is...

Expected behavior

No type error.

To Reproduce

import 'reflect-metadata'
import { NestFactory } from '@nestjs/core'
import { RenderModule } from 'nest-next'
import Next from 'next'

import { AppModule } from './app.module'
import { configService } from './config.service'

async function bootstrap() {
    const dev = !configService.isProduction()
    const app = Next({ dev })

    await app.prepare()

    const server = await NestFactory.create(AppModule)
    const renderer = server.get(RenderModule)

    // Error is here on "app"
    renderer.register(server, app, { dev, viewsDir: null })

    await server.listen(3000)
}

bootstrap()

Version

  • typescript: 3.7.3
  • next.js: 9.1.4
  • nest: 6.10.8
  • nest-next: 9.1.0

Jest Test Fails for CacheConfigService

For the example project, it could be something wrong with my configuration on my end, but I have an initial failing Jest test when running the test suite with no changes.

This is the error that I get:

Nest can't resolve dependencies of the CacheConfigService (?). Please make sure that the argument at index [0] is available in the TestModule context.

In addition, for the constants.sts file, I get an error for the line in there: I'm running the Jest VSCode extension so it might be the run that notified me of the error.

Cannot find module '@server/render/constants'

Missing module on Monorepo example

Describe the bug
Navigating to the route where next being served on monorepo example (eg: localhost:3000/about) will produce following error

Error: Cannot find module '../../ui/node_modules/next/dist/next-server/lib/constants.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15)
    at Function.Module._load (internal/modules/cjs/loader.js:539:25)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at eval (webpack-internal:///../next-server/lib/constants:1:18)
     at Object.../next-server/lib/constants (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:103:1)
    at __webpack_require__ (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:23:31)
    at eval (webpack-internal:///./node_modules/next/dist/pages/_document.js:20:18)
    at Object../node_modules/next/dist/pages/_document.js (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:148:1)
    at __webpack_require__ (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:23:31) code: 'MODULE_NOT_FOUND' }

Expected behavior
No error produced and the route serve the right component from nextjs

To Reproduce

  1. Clone this repo and run the example
  2. Build ui dto and server first (there is missing @types/webpack dependency, so i install it to ensure successful build)
  3. run npm run dev on server
  4. enter localhost:3000 or localhost:3000/about
  5. the page failed to load and following error is displayed in the server output
Error: Cannot find module '../../ui/node_modules/next/dist/next-server/lib/constants.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15)
    at Function.Module._load (internal/modules/cjs/loader.js:539:25)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at eval (webpack-internal:///../next-server/lib/constants:1:18)
     at Object.../next-server/lib/constants (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:103:1)
    at __webpack_require__ (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:23:31)
    at eval (webpack-internal:///./node_modules/next/dist/pages/_document.js:20:18)
    at Object../node_modules/next/dist/pages/_document.js (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:148:1)
    at __webpack_require__ (/Users/xxxx/nest-next/examples/monorepo/ui/.next/server/pages/_document.js:23:31) code: 'MODULE_NOT_FOUND' }

Version

  • next.js: 9.1.6
  • nest: 6.10.12
  • nest-next: 9.1.0

RenderService.setErrorHandler not working

I need custom nest error handling for logging and custom response. The documentation has a section on this: https://github.com/kyle-mccarthy/nest-next#handling-errors

I am going to use your library on a very large production project. So I really need help. If you point out what the problem is, I could help you solve it. And further help the development of your project

Example of my code:

// main.ts
async (): Promise<void> => {
  const app = await NestFactory.create(AppModule);

  const renderService = app.get(RenderService);

  renderService.setErrorHandler((err, req, res) => {
    console.log(err);

    res.send({
      error: 'Test',
    });
  });

  await app.listen(3000);
})();
export const About: FC = () => {
  throw new Error('Test error');

  return (
    <div>Sample feature</div>
  );
};

In dev mode, as a response, I get the default error page, but the callback is executed:
image

But the following errors get to the console:
image

In the browser:
image

In prod mode, no callback is executed at all. The browser displays a standard error page.


I also want to add that when using the global error handler, page rendering stops working. As I understand it, your library uses its own global error handler. I managed to solve this problem in this way:

// main.ts
(async (): Promise<void> => {
  const app = await NestFactory.create(AppModule);

  const errorFilter = app.select(ErrorFilterModule).get(ErrorFilter);

  const renderFilter = app.get(RenderFilter);

  errorFilter.setRenderFilter(renderFilter);

  app.useGlobalFilters(errorFilter);

  await app.listen(3000);
})();
export class ErrorFilter implements ExceptionFilter {
  private renderFilter: RenderFilter;

  public constructor(
    // ...
  ) {}

  public setRenderFilter(renderFilter: RenderFilter): void {
    this.renderFilter = renderFilter;
  }

  public async catch(error: Error, host: ArgumentsHost): Promise<void> {
    // ...

    if (req.path.includes('_next')) {
      await this.renderFilter.catch(error, host);

      return;
    }

    // ...
  }
}

An example of my code where the problem is reproduced: https://github.com/DiFuks/react-next-nest-boilerplate

To run a project:

  1. cp .env.dist .env
  2. npm run dev
  3. Open 127.0.0.1:3000/sample

For production build:

  1. Change the value of the NODE_ENV parameter in the .env file to "production"
  2. npm run prod

The file in which the error is thrown:
https://github.com/DiFuks/react-next-nest-boilerplate/blob/master/src/features/About/About.tsx

main.ts file:
https://github.com/DiFuks/react-next-nest-boilerplate/blob/master/src/server/main.ts

How to deploy an app

Describe the bug
There is no info in readme how to deploy an app

Expected behavior
I'm trying to deploy app by myself but i have problems what steps to follow. It would be great to have this info in README

To Reproduce

Repository URL:

Version

  • next.js:
  • nest:
  • nest-next:

Additional context
If i make it work by myself i will try to make pr for that, but for now it would be great to have some basic information how to approach this.

nest run fails if import dto in monorepo

Describe the bug
module.js:550
throw err;
^

Error: Cannot find module '/home/george/Documents/slovinar/server/dist/main'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3

Expected behavior
Imported interface does not influence the build

To Reproduce
Repository URL: https://github.com/SlavDom/slovinar

Version

  • next.js: 9.1.9
  • nest: 6.7.2
  • nest-next: 9.1.1

Additional context
If I do not add a type from 'dto' folder, the run is successful, but if I add the import, it fails.

Next <Link> re-render when user navigating

Thank you very much for creating this module. However, I found a bug that when I click on a link (use Next Link component), the page flashed. It should be render the pages seamlessly right?

Type mismatch server.ts INestApplication & INestAppliactionSubset

Describe the bug

NestFactory.create(): INestAppliactionSubset

doesn't match

renderer.register(server: INestAppliactionSubset)
(async () => {
  const app = next({
    dev: true,
  });
  const handler = routes.getRequestHandler(app);

  await app.prepare();

  const server = await NestFactory.create(AppModule);

  const renderer = server.get(RenderModule);

  // this won't compile either
  renderer.register(server as any, app);

  await server.use(handler).listen(3000);
})();

codelab-ui-nestjs____Code_UIB_codelab-ui-nestjs__-_____packages_core_server_server_ts

Expected behavior
match type

To Reproduce
Repository URL:

Version

  • next.js: 9.1.1
  • nest: 6.5.3
  • nest-next: 9.0.6

Facing error while running building production.

C:\Users\gaura\Desktop\basic>npm run start

> [email protected] start C:\Users\gaura\Desktop\basic
> cross-env NODE_ENV=production node .next/production-server/main.js

C:\Users\gaura\Desktop\basic\node_modules\next\dist\next-server\server\next-server.js:113
const filesystemUrls=this.getFilesystemPaths();const resolved=(0,_path.relative)(this.dir,untrustedFilePath);return filesystemUrls.has(resolved);}readBuildId(){const buildIdFile=(0,_path.join)(this.distDir,_constants.BUILD_ID_FILE);try{return _fs.default.readFileSync(buildIdFile,'utf8').trim();}catch(err){if(!_fs.default.existsSync(buildIdFile)){throw new Error(`Could not find a valid build in the '${this.distDir}' directory! Try building your app with 'next build' before starting the server.`);}throw err;}}get _isLikeServerless(){return(0,_config.isTargetLikeServerless)(this.nextConfig.target);}}exports.default=Server;function prepareServerlessUrl(req,query){const curUrl=(0,_url.parse)(req.url,true);req.url=(0,_url.format)({...curUrl,search:undefined,query:{...curUrl.query,...query}});}class NoFallbackError extends Error{}


Error: Could not find a valid build in the 'C:\Users\gaura\Desktop\basic\.next\.next' directory! Try building your app with 'next build' before starting the server.
    at Server.readBuildId (C:\Users\gaura\Desktop\basic\node_modules\next\dist\next-server\server\next-server.js:113:355)
    at new Server (C:\Users\gaura\Desktop\basic\node_modules\next\dist\next-server\server\next-server.js:3:120)
    at Object.createServer [as default] (C:\Users\gaura\Desktop\basic\node_modules\next\dist\server\next.js:2:638)
    at Object.<anonymous> (C:\Users\gaura\Desktop\basic\.next\production-server\application.module.js:34:65)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `cross-env NODE_ENV=production node .next/production-server/main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gaura\AppData\Roaming\npm-cache\_logs\2020-10-01T07_55_08_781Z-debug.log

Monorepo example does not have the viewsDir option set correctly

Describe the bug
By default, the renderer serves pages from pages/views, however the monorepo example has both views placed directly under pages.

Expected behavior
The example should work out-of-the-box when cloning the repo and trying it out. The solution would be to either place index.tsx and about.tsx under a views subfolder client-side (examples/monorepo/ui/pages), or add the viewsDir: '' option when importing the RenderModule in NestJS (examples/monorepo/server/src/application.module.ts).

Version

  • next.js: 9.1.6
  • nest: 6.10.12
  • nest-next: 9.1.0

How todo aliasing of nestjs module?

Hi,

Thanks for creating this amazing lib. I am trying to add nest-next lib in my existing project. But I am not able to aliasing in nestjs.

tsconfig.json

{ "compilerOptions": { "target": "esnext", "module": "esnext", "jsx": "preserve", "pretty": true, "noImplicitAny": true, "alwaysStrict": true, "strictNullChecks": false, "strict": false, "noImplicitReturns": true, "noImplicitThis": true, "outDir": ".next", "moduleResolution": "node", "allowSyntheticDefaultImports": true, "esModuleInterop": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "sourceMap": true, "skipLibCheck": true, "lib": [ "es2017", "dom" ], "baseUrl": "./server", "typeRoots": [ "node_modules/@types", "./typings" ], "allowJs": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "resolveJsonModule": true, "isolatedModules": true, "paths": { "@environments": ["environments"], "@utils": ["utils"], "@shared": ["shared"] } }, "include": [ "./pages/**/*", "server/**/*", "node_modules/src" ], "compileOnSave": false, "exclude": [ "node_modules" ] }

tsconfig.server.json

{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": ".next/production-server", "declaration": true, "target": "es6", "module": "commonjs", "moduleResolution": "node", "experimentalDecorators": true, "emitDecoratorMetadata": true, "isolatedModules": true, "noEmit": false, "allowJs": false, "paths": { "@environments": ["environments"], "@utils": ["utils"], "@shared": ["shared"] } }, "include": ["./server/**/*"], "exclude": ["node_modules"] }

tsconfig-paths-bootstrap.js

const tsConfig = require('./tsconfig.server.json'); const tsConfigPaths = require('tsconfig-paths'); const baseUrl = './server'; // Either absolute or relative path. If relative it's resolved to current working directory. tsConfigPaths.register({ baseUrl, paths: tsConfig.compilerOptions.paths, });

Cache-Control header

Hi, 😃
I have the problem that I try to set the "Cache Control" header, but unfortunately this doesn't work.

For this I use a NestInterceptor:

@Injectable()
export class CacheControlInterceptor implements NestInterceptor {
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    const parsedContext  = getContext(context);
    parsedContext.res.header('Cache-Control', 'public, max-age='+(60*60*24))// 1 day
    return next.handle();
  }
}

and the following route:

  @Get()
  @UseInterceptors(CacheControlInterceptor)
  @Render('index')
  public index() {
    // initial props
    return {
      title: 'Next with Nest',
    };
  }

But in this case I get the following header:

...
Cache-Control →no-store, must-revalidate
...

If I use a route without rendering, I get the correct HEader back.:

  @Get("/Test")
  @UseInterceptors(CacheControlInterceptor)
  public dsadas() {
    // initial props
    return {
      title: 'Next with Nest',
    };
  }
...
Cache-Control →public, max-age=86400
...

Thank you for your work.

Usage with next-routes

The controller stops working if I use the routes handler.

codelab-ui-nestjs____Code_UIB_codelab-ui-nestjs__-_____packages_core_server_server_ts

codelab-ui-nestjs____Code_UIB_codelab-ui-nestjs__-_____packages_core_server_app_app_controller_ts

I'm also unable to access useRouter().query from next/router if I'm using routing with controller

Dynamic routes. strange error

"nest-next": "^9.2.0",

The issue is in dynemic route:

  • Expected behavior:
    in app.controller.ts
    @Get('category/:test') public category(@Res() res: RenderableResponse) { res.render('category/[...test]'); }

in the component :
<Link href='/category/[test]' as='/category/negligence'>

I want that [...test].tsx in pages/views/category/[...test].tsx render withought any issues
when the "/category/negligence" Link was clicked

observes :
an error : Unhandled Runtime Error
Error: The provided as value (/category/negligence) is incompatible with the href value (/views/category/[...test]). Read more: https://err.sh/vercel/next.js/incompatible-href-as
Selection_999(416)

Could I use `res.render` to render a component

Hello

Use res.render, I could do this

...
  @Get()
  // @Render('User/LoginForm')
  public async login(@Res() res: any) {
    return res.render('User/LoginForm');
  }
...
...
  @Get()
  public async login(@Res() res: any) {
    if (condition A) {
       return res.render('A');
    }
    return res.render('B');
  }
...

I think that nest-next it run as a engine powered by next, and next provides a few of some render method. Is there some samples to use these renderMethod easily?

image

Are getStaticProps and getServerSideProps supported?

In example I see that you use getInitialProps function. But in the official doc there is an info that it's better to use getStaticProps and getServerSideProps.

I downloaded your example, installed last version of next, replaced getInitialProps -> getStaticProps and started an app.

export const getStaticProps = async (arg) => {
  // arg is {}
};

What I see? The argument is empty object.

After that I opened this official doc (https://nextjs.org/docs/advanced-features/custom-server) and found the next info:

A custom server will remove important performance optimizations, like serverless functions and Automatic Static Optimization.

If I am right, it's exactly what this library do - replace next's server with custom one (from nest js).
So, am I right that if I choose this library, then there will be no ways to cache generated pages and I will have to render it on every request?

Or maybe you have some ideas and in the future versions you are going to implement it?

Question about the usage of the renderer

Hi @kyle-mccarthy! Thanks for sharing this module.

I have a use case where I don't want to descriminate the pages in the controller that uses the renderer. I want it to be a catch all.

At first sight, it seems as everything was ok, but then I noticed that the assets were not being served.

A little investigation led me to learn that next's render method is only suited for pages although it also serves assets if they are from _next or from static folder.

With the advent of the public folder this behaviour broke because the render method does not cater to it.

I am left with two solutions.

  1. Enumerate all possible routes in the controller and let the filter catch the rest
  2. Use the RenderService's getRequestHandler which is an all purpose method.

I'm going with the latter which brings me to the question. Why not use it always and avoid the filter?

Invalid hook call in monorepo example

Describe the bug
The setup as shown in monorepo example apparently includes React twice in the final bundles, making it impossible to use hooks due to hook violation

Expected behavior
I'd expect hooks to be working correctly - like they do in basic example.
I'd expect React to be included once - as I suspect this is the cause of hooks failure

To Reproduce

  1. clone the monorepo example
  2. add const [x] = useState(1) to index.tsx or any other hook usage
const IndexPage: NextPage<IndexProps> = props => {
    const [x] = useState(1)

    return (
        <div>
            <p>
                Hello hook {x}.{' '}
                <Link href="/about">
                    <a>About us</a>
                </Link>
            </p>
        </div>
    )
};
  1. see the error probably caused by multiple instances of React included in the bundles:
Server Error
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
resolveDispatcher
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/ui/node_modules/react/cjs/react.development.js (1465:13)
useState
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/ui/node_modules/react/cjs/react.development.js (1496:20)
IndexPage
webpack-internal:///./pages/index.tsx (14:61)
processChild
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/react-dom/cjs/react-dom-server.node.development.js (3043:14)
resolve
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/react-dom/cjs/react-dom-server.node.development.js (2960:5)
ReactDOMServerRenderer.render
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/react-dom/cjs/react-dom-server.node.development.js (3435:22)
ReactDOMServerRenderer.read
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/react-dom/cjs/react-dom-server.node.development.js (3373:29)
renderElementToString
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/react-dom/cjs/react-dom-server.node.development.js (3988:27)
render
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/server/render.tsx (130:12)
Object.renderPage
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/server/render.tsx (721:12)
Function.getInitialProps
webpack-internal:///../server/node_modules/next/dist/pages/_document.js (133:19)
loadGetInitialProps
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/lib/utils.ts (306:27)
renderToHTML
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/server/render.tsx (730:48)
<unknown>
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/server/next-server.ts (1054:24)
<unknown>
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/server/next-server.ts (1023:25)
DevServer.renderToHTMLWithComponents
file:///Users/adambar/Projects/tests/nest-next/examples/monorepo/server/node_modules/next/next-server/server/next-server.ts (1131:9)

Version

  • next.js: 9.4.4
  • nest: 6.11.11
  • nest-next: 9.2.0

Additional context

Hooks work fine in basic example.

the build process doesn't end

Hi, I encountered a very strange problem that when I used the package 'socket.io-client' in my project, the build process did not end up and exit, but will instead stay after the 'Compiled successfully' info.

import io from "socket.io-client";
const socket = io("http://localhost:4000");

image
But when I use ctrl+c and npm run start, the project seems to be working quite well. I don't know much about Babel, and can't solve this problem.

Using with GraphQl (resolver)

First of all many thanks for this great package 👍 Now I have a problem using this package with grapqhl (resolver).
I always get the following output when a graphql error occurs:

{
  "errors": [
    {
      "message": "Cannot read property 'raw' of undefined",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "ArticleListAll"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "TypeError: Cannot read property 'raw' of undefined",
            "    at RenderFilter.<anonymous> (/home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/nest-next/dist/render.filter.js:36:33)",
            "    at Generator.next (<anonymous>)",
            "    at /home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/nest-next/dist/render.filter.js:16:71",
            "    at new Promise (<anonymous>)",
            "    at __awaiter (/home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/nest-next/dist/render.filter.js:12:12)",
            "    at RenderFilter.catch (/home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/nest-next/dist/render.filter.js:28:16)",
            "    at ExternalExceptionsHandler.invokeCustomFilters (/home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/@nestjs/core/exceptions/external-exceptions-handler.js:33:32)",
            "    at ExternalExceptionsHandler.next (/home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/@nestjs/core/exceptions/external-exceptions-handler.js:12:29)",
            "    at /home/rene/Projects/SmashoBase/nest/smasho-base/node_modules/@nestjs/core/helpers/external-proxy.js:12:42",
            "    at process._tickCallback (internal/process/next_tick.js:68:7)"
          ]
        }
      }
    }
  ],
  "data": {
    "ArticleListAll": null
  }
}

Also "setErrorHandler" is not triggered. A normal controller triggers it.

Thanks for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.