Skip to content

@angular-devkit/build-angular update from 12.1.x to 12.2.x SSR fails to serve #21735

Closed

Description

@rickvandermey

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 12.1.4

Description

When building a SSR application, and serving the SSR application, it used to work, but after the update, an error is logged during the process.

TypeError: Cannot convert undefined or null to object
    at Function.getPrototypeOf (<anonymous>)
    at /Users/Sources/angular-starterkit/dist/server/main.js:1:2701809
    at Object.66252 (/Users/Sources/angular-starterkit/dist/server/main.js:1:2815455)
    at __webpack_require__ (/Users/Sources/angular-starterkit/dist/server/main.js:1:3657752)
    at Object.42853 (/Users/Sources/angular-starterkit/dist/server/main.js:1:2904269)
    at __webpack_require__ (/Users/Sources/angular-starterkit/dist/server/main.js:1:3657752)
    at Module.25944 (/Users/Sources/angular-starterkit/dist/server/main.js:1:2908930)
    at __webpack_require__ (/Users/Sources/angular-starterkit/dist/server/main.js:1:3657752)
    at app (/Users/Sources/angular-starterkit/dist/server/main.js:1:5131921)
    at run (/Users/Sources/angular-starterkit/dist/server/main.js:1:5133175)

🔬 Minimal Reproduction

https://github.com/rickvandermey/angular-starterkit/tree/feature/update-deps

Steps:

  • npm ci
  • npm run start:ssr

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.2.5
Node: 14.16.1
Package Manager: npm 7.21.0
OS: darwin x64

Angular: 12.2.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.5
@angular-devkit/build-angular   12.2.5
@angular-devkit/core            12.2.5
@angular-devkit/schematics      12.2.5
@nguniversal/express-engine     12.1.0
@schematics/angular             12.2.5
rxjs                            7.3.0
typescript                      4.3.5
webpack                         5.52.0

Activity

  1. alan-agius4 commented on Sep 9, 2021

    @alan-agius4
    Collaborator

    The problem appear to be this statement.

     const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf( /*#__PURE__*/_wrapAsyncGenerator(function* () {})).prototype);

    Which is the result of transforming native async/await in generators since Zone.Js cannot patch these.

    https://github.com/MattiasBuelens/web-streams-polyfill/blob/d035366b4033fd0c8af092d3a6938bd9c6d5974d/src/target/es2018/stub/async-iterator-prototype.ts#L4-L5

    export const AsyncIteratorPrototype: AsyncIterable<any> | undefined =
      Object.getPrototypeOf(Object.getPrototypeOf(async function* (): AsyncIterableIterator<any> {}).prototype);
  2. alan-agius4 commented on Sep 9, 2021

    @alan-agius4
    Collaborator

    Looking at this more, the downlevelling of the async/await is doing the right thing and the correct output is being generated. Unfortunately, web-streams-polyfill isn't handle this case.

    This should be pretty straightforward from their end to fix;

      const AsyncFnPrototype = Object.getPrototypeOf(async function* () {}).prototype;
      const AsyncIteratorPrototype = AsyncFnPrototype && Object.getPrototypeOf(AsyncFnPrototype);
  3. alan-agius4 commented on Sep 9, 2021

    @alan-agius4
    Collaborator

    Closing as per above.

  4. modified the milestone: Backlog on Sep 10, 2021
  5. krzkz94 commented on Oct 4, 2021

    @krzkz94

    Hey @alan-agius4, are you folks going to fix this for v12? It seems to be still broken with the latest 12.2.8

  6. alan-agius4 commented on Oct 4, 2021

    @alan-agius4
    Collaborator

    @krzkz94, it looks like the commit was not cherry-picked due to a conflict.

    We should be addressing this in the next patch release.

  7. rickvandermey commented on Oct 7, 2021

    @rickvandermey
    Author

    Can confirm its fixed in 12.2.9

  8. angular-automatic-lock-bot commented on Nov 7, 2021

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions