Skip to content

Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported. #111

@echo-liang

Description

@echo-liang

Describe the bug
Trying out nest-next with this setup: (I set the Next.js version to 13.4.2, due to issue 107)

"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"nest-next": "^10.1.0",
"next": "^13.4.2",

With project folder structure shown below:
├───src
│ ├───app
│ │ └───lookup
│ ├───client
│ ├───server
│ └───shared
└───test
Folder, app, contains Next.js assets (page.tsx, layout.tsx etc), I tried to use Next.js app router.

  • When starts up the app in Next server, no warnings messages regardless whether using page router or app router.
  • When starts the app in Nest server, using Next.js page router (i.e., delete app folder, replace it with pages folder and associated tsx files), the warning messages disappears.
  • When starts up the app in Nest server, using app router, the page renders with no issue, but the below warning messages shown in the console log:
    [1:21:27 PM] File change detected. Starting incremental compilation...
    [1:21:27 PM] Found 0 errors. Watching for file changes.
    [Nest] 13628 - 10/31/2023, 1:21:30 PM LOG [NestFactory] Starting Nest application...
    event compiled client and server successfully in 3.8s (303 modules)
    [Nest] 13628 - 10/31/2023, 1:21:41 PM LOG [InstanceLoader] AppModule dependencies initialized +11338ms
    [Nest] 13628 - 10/31/2023, 1:21:41 PM LOG [InstanceLoader] RenderModule dependencies initialized +0ms
    [Nest] 13628 - 10/31/2023, 1:21:41 PM LOG [RoutesResolver] AppController {/}: +126ms
    [Nest] 13628 - 10/31/2023, 1:21:41 PM LOG [RouterExplorer] Mapped {/, GET} route +42ms
    [Nest] 13628 - 10/31/2023, 1:21:41 PM LOG [RouterExplorer] Mapped {/agency, GET} route +1ms
    [Nest] 13628 - 10/31/2023, 1:21:41 PM LOG [NestApplication] Nest application successfully started +5ms
    wait compiling /_error (client and server)...
    event compiled client and server successfully in 295 ms (304 modules)
    warn Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
    wait compiling /agency/page (client and server)...
    event compiled client and server successfully in 2.8s (485 modules)
    warn Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
    Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.
    at InsertedHTML (C:\Users\177040\LEA\eval\nest-next-3\lea\node_modules\next\dist\server\app-render\app-render.js:835:33)
    Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.
    at Router (webpack-internal:///(sc_client)/./node_modules/next/dist/client/components/app-router.js:86:11)
    at ErrorBoundaryHandler (webpack-internal:///(sc_client)/./node_modules/next/dist/client/components/error-boundary.js:62:9)
    at ErrorBoundary (webpack-internal:///(sc_client)/./node_modules/next/dist/client/components/error-boundary.js:86:11)
    at AppRouter (webpack-internal:///(sc_client)/./node_modules/next/dist/client/components/app-router.js:361:13)
    at Lazy
    at Lazy
    at ServerComponentWrapper (C:\Users\177040\LEA\eval\nest-next-3\lea\node_modules\next\dist\server\app-render\create-server-components-renderer.js:78:31)
    at ServerComponentWrapper (C:\Users\177040\LEA\eval\nest-next-3\lea\node_modules\next\dist\server\app-render\create-server-components-renderer.js:78:31)
    at InsertedHTML (C:\Users\177040\LEA\eval\nest-next-3\lea\node_modules\next\dist\server\app-render\app-render.js:835:33)

Expected behavior
When the app starts up in Nest server, renders pages using either Next.js app router or page router shouldn't generate warning messages

Version

  • next.js: 13.4.2
  • nest: 10.0.0
  • nest-next: 10.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions