Repository navigation
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimecore: event dispatchstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
platform-browser
Is this a regression?
No
Description
When using EventReplay via withEventReplay(), we receive an error inside one of our interceptors, in the marked line in the interceptor we use 'setTimeout'
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
`TypeError: Cannot read properties of undefined (reading '_ejsa')
at getJsactionData (core.mjs:36732:22)
at initEventReplay (core.mjs:36740:31)
at core.mjs:36716:29
at _ZoneDelegate.invoke (zone.js:368:26)
at Object.onInvoke (core.mjs:15898:33)
at _ZoneDelegate.invoke (zone.js:367:52)
at Zone.run (zone.js:129:43)
at zone.js:1257:36
at _ZoneDelegate.invokeTask (zone.js:402:31)
at core.mjs:15583:55
at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:15583:36)
at _ZoneDelegate.invokeTask (zone.js:401:60)
at Object.onInvokeTask (core.mjs:15885:33)
at _ZoneDelegate.invokeTask (zone.js:401:60)
at Zone.runTask (zone.js:173:47)`
Please provide the environment you discovered this bug in (run ng version)
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 18.0.3
Node: 22.2.0
Package Manager: npm 10.7.0
OS: darwin arm64
Angular: 18.0.3
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, google-maps, language-service, material
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker, ssr
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1800.3
@angular-devkit/build-angular 18.0.3
@angular-devkit/core 18.0.3
@angular-devkit/schematics 18.0.3
@schematics/angular 18.0.3
ng-packagr 18.0.0
rxjs 7.5.7
typescript 5.4.3
webpack 5.91.0
zone.js 0.14.3
Anything else?
No response
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimecore: event dispatchstate: has PR
Activity
Fluccioni commentedon Jun 14, 2024
I have currently the same TypeError, but I'm not sure it has something to do with the use of setTimeout.
I came across this comment in the initEventReplay function saying we may encounter undefined reading 'ngContracts'.
If it is the case, therefore the const container will be undefined too and the error will be thrown on the invocation of
getJsactionData.The problem seems to be the bundle jsaction contract script not correctly inlined during the html generation, which might be the case while using the "old" browser builder instead of esbuild from what I saw
AndrewKushnir commentedon Jun 19, 2024
Thanks for reporting this issue. I was able to reproduce it for cases when there are no events registered in an application, but Event Replay feature is enabled. I've created PR #56509 with the fix.
@Fluccioni the mentioned PR would likely resolve that problem as well (there will be no JS exceptions), but we may consider adding some logic to detect those cases and add a warning. Could you please create a minimal repro (in a form of GitHub repository), so that we can perform further investigation to see if we can detect those cases?
fix(core): do not activate event replay when no events are registered (…
fix(core): do not activate event replay when no events are registered (…
AndrewKushnir commentedon Jun 20, 2024
@Fluccioni @phihochzwei just wanted to share a quick update: the fix was merged and released to NPM. Please try updating to Angular v18.0.4 and let us know if the problem still exists. Thank you.
Fluccioni commentedon Jun 21, 2024
@AndrewKushnir Sorry I didn't had time to setup a quick repro yet with custom builders, thanks for the fix though indeed there is no more the exception thrown w/ 18.0.4
angular-automatic-lock-bot commentedon Jul 22, 2024
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.