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

"prerender": false is ignored with "outputMode": "server" #28590

Closed
1 task
zip-fa opened this issue Oct 7, 2024 · 6 comments · Fixed by #28595
Closed
1 task

"prerender": false is ignored with "outputMode": "server" #28590

zip-fa opened this issue Oct 7, 2024 · 6 comments · Fixed by #28595
Assignees

Comments

@zip-fa
Copy link

zip-fa commented Oct 7, 2024

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Hi.
"prerender": false is ignored with "outputMode": "server": angular tries to prerender all my routes and i receive "undefined" message on routes extraction step:

Image

ng build command now only reacts to "export NG_BUILD_PARTIAL_SSR=true && ng build" - build does not fail with this setup

Minimal Reproduction

ng build

Exception or Error

No response

Your Environment

v19.0.0-next.8

Anything else relevant?

No response

@alan-agius4
Copy link
Collaborator

It is by design that the prerender option is ignored.

The outputMode is only intended to be used with the new SSR APIs, where the rendering modes are configured at route level.

That being said, the error is definitely not helpful, can you please provide a minimal reproduction?

@alan-agius4 alan-agius4 added type: bug/fix needs: repro steps We cannot reproduce the issue with the information given labels Oct 7, 2024
@alan-agius4 alan-agius4 self-assigned this Oct 7, 2024
@zip-fa
Copy link
Author

zip-fa commented Oct 7, 2024

My current serverRoutes config is:

import type { ServerRoute } from '@angular/ssr';
import { RenderMode } from '@angular/ssr';

export const serverRoutes: ServerRoute[] = [
  {
    path: '**',
    renderMode: RenderMode.Server,
    headers: {
      'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate',
      'Pragma': 'no-cache',
      'Expires': '0',
      'Surrogate-Control': 'no-store'
    }
  }
];

app.config.server is:

import { mergeApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';
import { provideServerRoutesConfig } from '@angular/ssr';

import { appConfig } from './app.config';
import { serverRoutes } from './app.routes.server';

export const config = mergeApplicationConfig(appConfig, {
  providers: [provideServerRendering(), provideServerRoutesConfig(serverRoutes)]
});

Shouldn't prerender be completly disabled with this configuration?
About "undefined" error: i will make repro in some time & add another comment

@alan-agius4
Copy link
Collaborator

With this config, indeed none of the routes will be pre-rendered. Although the application will still be bootstrapped during the build to generate the SSR manifest.

@zip-fa
Copy link
Author

zip-fa commented Oct 7, 2024

Alright, it took me 2 hours to find the cause of "undefined" error.

I've modified prerender.js directly in node_modules :))
Image

To find this:

Image

@zip-fa
Copy link
Author

zip-fa commented Oct 7, 2024

I've added catchError with isPlatformServer check to my global http interceptor and now everything works perfect:

  • build goes ok
  • server doesn't crash

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Oct 8, 2024
Handle cases where the error stack is missing by displaying a relevant message.

Closes angular#28590
@alan-agius4 alan-agius4 removed needs: repro steps We cannot reproduce the issue with the information given area: @angular/ssr labels Oct 8, 2024
alan-agius4 added a commit that referenced this issue Oct 8, 2024
Handle cases where the error stack is missing by displaying a relevant message.

Closes #28590
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants