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

Build application with prerender routes file fails #27251

Closed
wendevlin opened this issue Mar 11, 2024 · 4 comments · Fixed by #27253
Closed

Build application with prerender routes file fails #27251

wendevlin opened this issue Mar 11, 2024 · 4 comments · Fixed by #27253

Comments

@wendevlin
Copy link

wendevlin commented Mar 11, 2024

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

I migrated my app to Angular 17 --> works as expected.

Now I want to get rid of my webpack build.

So I migrate my prerendering to @angular-devkit/build-angular:application:


          "builder": "@angular-devkit/build-angular:application",
          "options": {
              "outputPath": "dist/browser",
              "index": "src/index.html",
              "browser": "src/main.ts",
              "polyfills": [ "src/polyfills.ts" ],
              "tsConfig": "tsconfig.app.json",
              "inlineStyleLanguage": "scss",
              "assets": [
                "src/favicon.ico",
                "src/assets",
                "src/sitemap.xml",
                "src/robots.txt"
              ],
              "styles": [
                "src/styles.scss"
              ],
              "scripts": [],
              "prerender": {
                "discoverRoutes": false,
                "routesFile": "routes.txt"
              }
          },
....

when I run then the build with ng build I get following error:

An unexpected error occurred: [object Object]
error: script "build" exited with code 1

This only happens when prerender options is:

              "prerender": {
                "discoverRoutes": false,
                "routesFile": "routes.txt"
              }
              "prerender": {
                "routesFile": "routes.txt"
              }
              "prerender": {
                "discoverRoutes": true,
              }
              "prerender":  true

my routes.txt is correct.

Please provide a link to a minimal reproduction of the bug

https://github.com/WhizUs-Labs/angular-prerender-test

Please provide the exception or error you saw

An unexpected error occurred: [object Object]
error: script "build" exited with code 1

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.2.3
Node: 20.11.1
Package Manager: bun 1.0.30
OS: linux x64

Angular: 17.2.4
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.3
@angular-devkit/build-angular   17.2.3
@angular-devkit/core            17.2.3
@angular-devkit/schematics      17.2.3
@angular/cdk                    17.2.2
@angular/cli                    17.2.3
@angular/google-maps            17.2.2
@angular/ssr                    17.2.3
@schematics/angular             17.2.3
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.4

Anything else?

No response

@JeanMeche JeanMeche transferred this issue from angular/angular Mar 11, 2024
@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Mar 11, 2024
@alan-agius4
Copy link
Collaborator

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@wendevlin
Copy link
Author

Hi,

Sure: https://github.com/WhizUs-Labs/angular-prerender-test

My serve is also not working with this example. Maybe it is just a config issue, but what definitely is a bug is the error message, because object object doesn´t help to solve the issue.

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@alan-agius4
Copy link
Collaborator

The problem in this case is that the "server" entrypoint is not defined. I'll open a PR to fix the error message.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 11, 2024
… server option is required but missing

This improves the error message when the server entry-point is required but missing

Closes angular#27251
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 11, 2024
… server option is required but missing

This improves the error message when the server entry-point is required but missing

Closes angular#27251
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 12, 2024
…inating in ESM loader hooks

Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: angular#27251
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 12, 2024
…inating in ESM loader hooks

Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: angular#27251
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 12, 2024
…inating in ESM loader hooks

Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: angular#27251
alan-agius4 added a commit that referenced this issue Mar 12, 2024
… server option is required but missing

This improves the error message when the server entry-point is required but missing

Closes #27251
alan-agius4 added a commit that referenced this issue Mar 12, 2024
… server option is required but missing

This improves the error message when the server entry-point is required but missing

Closes #27251

(cherry picked from commit 1034bb1)
alan-agius4 added a commit that referenced this issue Mar 12, 2024
… server option is required but missing

This improves the error message when the server entry-point is required but missing

Closes #27251

(cherry picked from commit 1034bb1)
@alan-agius4 alan-agius4 removed the needs: repro steps We cannot reproduce the issue with the information given label Mar 12, 2024
alan-agius4 added a commit that referenced this issue Mar 12, 2024
…inating in ESM loader hooks

Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: #27251
alan-agius4 added a commit that referenced this issue Mar 12, 2024
…inating in ESM loader hooks

Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: #27251
(cherry picked from commit 51debcd)
alan-agius4 added a commit that referenced this issue Mar 12, 2024
…inating in ESM loader hooks

Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: #27251
(cherry picked from commit 51debcd)
@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 Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants