You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[zone.js] Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver #47872
Prerendering throws an error when used with a Node version > 16.17.1
🐞 Bug report
What modules are related to this issue?
builders
common
express-engine
Is this a regression?
Yes, the previous version in which this bug was not present was: 14.x
🔬 Minimal Reproduction
Create a new v15 CLI workspace, add SSR and run prerendering:
npx -p @angular/cli@next ng new testproject --routing --style=css
cd testproject
npm run ng -- add @nguniversal/express-engine@next
npm run ng -- run testproject:prerender
🔥 Exception or Error
Warning directly after the start:
TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browerslist configuration. For more information, see https://github.com/browserslist/browserslist
Error at prerendering:
✖ Prerendering routes to testproject/browser failed.
Method Promise.prototype.then called on incompatible receiver [object Object]
This happens with Node v16.18.0 🔥 and v18.11.0 🔥. The error does not appear with Node v16.17.0 ✅ .
changed the title [-]Prerendering error: Method Promise.prototype.then called on incompatible receiver[/-][+]Prerendering error with Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver[/+]on Oct 26, 2022
$ node index.js
node:internal/per_context/primordials:440
new SafePromise((a, b) => PromisePrototypeThen(mapFn == null ? promise : mapFn(promise, i), a, b))
^
TypeError: Method Promise.prototype.then called on incompatible receiver [object Object]
at ZoneAwarePromise.then (<anonymous>)
at node:internal/per_context/primordials:440:35
at new Promise (<anonymous>)
changed the title [-]Prerendering error with Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver[/-][+][zone.js] Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver[/+]on Dec 5, 2022
Activity
ohois commentedon Oct 26, 2022
Same problem with Angular 14.2.X and any node version > 16.17.1 (just tested it against current LTS node Version 18.12.0)
[-]Prerendering error: Method Promise.prototype.then called on incompatible receiver[/-][+]Prerendering error with Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver[/+]fmalcher commentedon Oct 26, 2022
@ohois Thanks for the background info, I can confirm this!
alan-agius4 commentedon Oct 26, 2022
From the looks of it, it looks like a zone.js issue. Transferring to the framework repo.
alan-agius4 commentedon Oct 26, 2022
This can be replicated without universal by using the below code.
index.js
alan-agius4 commentedon Oct 26, 2022
This seems to be caused by nodejs/node#43728.
Following a suggestion by @JiaLiPassion I have added a temporary workaround in universal via angular/universal#2879.
ohois commentedon Oct 26, 2022
I can confirm that this workaround fixes this issue on my end.
pankaj-yadav0507 commentedon Oct 31, 2022
Noob question.
Facing the same issue. But don't know how to use that temporary workaround mentioned by @alan-agius4
ohois commentedon Oct 31, 2022
cipchk commentedon Nov 1, 2022
alan-agius4 commentedon Nov 1, 2022
8 remaining items
[-]Prerendering error with Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver[/-][+][zone.js] Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver[/+]angular-automatic-lock-bot commentedon Mar 30, 2023
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.