René's URL Explorer Experiment


Title: `beforeAuthStateChanged` imported from `@angular/fire/auth` makes `ng build` fail during route extraction · Issue #3748 · angular/angularfire · GitHub

Open Graph Title: `beforeAuthStateChanged` imported from `@angular/fire/auth` makes `ng build` fail during route extraction · Issue #3748 · angular/angularfire

X Title: `beforeAuthStateChanged` imported from `@angular/fire/auth` makes `ng build` fail during route extraction · Issue #3748 · angular/angularfire

Description: Description @angular/fire/auth wraps beforeAuthStateChanged as ɵzoneWrap(_beforeAuthStateChanged, true) (src/auth/firebase.ts line 61). With that flag, the wrapper registers a pending task as soon as a callback is passed and clears it on...

Open Graph Description: Description @angular/fire/auth wraps beforeAuthStateChanged as ɵzoneWrap(_beforeAuthStateChanged, true) (src/auth/firebase.ts line 61). With that flag, the wrapper registers a pending task as soon ...

X Description: Description @angular/fire/auth wraps beforeAuthStateChanged as ɵzoneWrap(_beforeAuthStateChanged, true) (src/auth/firebase.ts line 61). With that flag, the wrapper registers a pending task as soon ...

Opengraph URL: https://github.com/angular/angularfire/issues/3748

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`beforeAuthStateChanged` imported from `@angular/fire/auth` makes `ng build` fail during route extraction","articleBody":"### Description\n\n`@angular/fire/auth` wraps `beforeAuthStateChanged` as `ɵzoneWrap(_beforeAuthStateChanged, true)` (`src/auth/firebase.ts` line 61). With that flag, the wrapper registers a pending task as soon as a callback is passed and clears it only when the callback first fires or the returned unsubscribe runs (`src/zones.ts`). This callback only fires when a sign-in or sign-out happens, so an app that registers the hook at startup holds the pending task open and `ApplicationRef.isStable` never becomes true for a visitor who is not signing in or out.\n\n`ng build` route extraction waits on app stability, so any server-rendered app that registers this hook in its app config cannot build. Extraction hangs for about 30 seconds, then:\n\n```\nAbortError: Routes extraction was aborted.\nTimeoutError: The operation was aborted due to timeout\n```\n\n### Steps to reproduce\n\n1. Fresh `ng new --ssr` Angular 21 app, `ng add @angular/fire@next`.\n2. In `app.config.ts`, register `beforeAuthStateChanged` inside `provideAppInitializer`, imported from `@angular/fire/auth`. Registering it at startup is exactly what an SSR token-cookie sync does (docs/auth.md, Server-side Rendering section).\n3. `ng build` fails with the error above (34 seconds in my run).\n4. Change only the import to `firebase/auth`. The identical code builds in under 5 seconds.\n\n### Expected behavior\n\nRegistering the hook does not permanently block app stability. `onMessage` in `src/messaging/firebase.ts` wraps the same shape of API, a callback that may never fire, with the flag set to false, which still zone-wraps the callback and only skips the pending task. The same flag here looks like the fix, pending a check that nothing relies on the blocking behavior. `onLog` in `src/app/firebase.ts` has the same shape and is worth sweeping at the same time.\n\n### Workarounds in the wild\n\nOur own sample already imports `beforeAuthStateChanged` from `firebase/auth` (`sample/src/app/auth/auth.component.ts`), and the rewritten SSR docs section in #3740 documents that import as the way around this bug.\n\n### Versions\n\nReproduced on an Angular 21 app against the @angular/fire 21 canary. The wrapper is unchanged on current `main`.\n","author":{"url":"https://github.com/armando-navarro","@type":"Person","name":"armando-navarro"},"datePublished":"2026-08-17T22:02:35Z","url":"https://github.com/angular/angularfire/issues/3748"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0fd06304-95a8-c7a6-25f5-093717416898
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBAD6:1F320A:8CF05A:B1CD3C:6B035FFC
html-safe-nonce82851975e1873708b07fa09c9a3a43229f6428a952966093a335bd359d42cc80
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQUQ2OjFGMzIwQTo4Q0YwNUE6QjFDRDNDOjZCMDM1RkZDIiwidmlzaXRvcl9pZCI6IjYwNjcyNDY5OTY1NjgzNjcxMDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc6cfaf715b2ec75c0bbef98527b2d4170547c4edb1e4ed673db3aaa41ca0d4cc
hovercard-subject-tagissue:5175836677
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angularfire/3748/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2d61f3a846d0f059e2fc5a48c53fef396ad167168616badcbb6d8df592db46f5/angular/angularfire/issues/3748
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2d61f3a846d0f059e2fc5a48c53fef396ad167168616badcbb6d8df592db46f5/angular/angularfire/issues/3748
og:image:altDescription @angular/fire/auth wraps beforeAuthStateChanged as ɵzoneWrap(_beforeAuthStateChanged, true) (src/auth/firebase.ts line 61). With that flag, the wrapper registers a pending task as soon ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamearmando-navarro
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/angular/angularfire git https://github.com/angular/angularfire.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id49453413
octolytics-dimension-repository_nwoangular/angularfire
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49453413
octolytics-dimension-repository_network_root_nwoangular/angularfire
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angularfire/issues/3748#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangularfire%2Fissues%2F3748
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangularfire%2Fissues%2F3748
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangularfire
Reloadhttps://github.com/angular/angularfire/issues/3748
Reloadhttps://github.com/angular/angularfire/issues/3748
Reloadhttps://github.com/angular/angularfire/issues/3748
angularhttps://github.com/angular
angularfirehttps://github.com/angular/angularfire
Codehttps://github.com/angular/angularfire
Issues162 (162)https://github.com/angular/angularfire/issues
Pull requests5 (5)https://github.com/angular/angularfire/pulls
Discussionshttps://github.com/angular/angularfire/discussions
Actionshttps://github.com/angular/angularfire/actions
Projectshttps://github.com/angular/angularfire/projects
Security and qualityhttps://github.com/angular/angularfire/security
Insightshttps://github.com/angular/angularfire/insights
https://github.com/angular/angularfire
New issuehttps://github.com/login?return_to=https://github.com/angular/angularfire/issues/3748
New issuehttps://github.com/login?return_to=https://github.com/angular/angularfire/issues/3748
#3770https://github.com/angular/angularfire/pull/3770
beforeAuthStateChanged imported from @angular/fire/auth makes ng build fail during route extractionhttps://github.com/angular/angularfire/issues/3748#top
#3770https://github.com/angular/angularfire/pull/3770
comp: authAuthentication (src/auth).https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20auth%22
comp: ssrServer-side rendering, hydration, @angular/ssr interop.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20ssr%22
comp: zonesChange detection / zone.js / zoneless.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20zones%22
type: bugDefect: expected behavior doesn't happen.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
version: current (v17+)Targets the current modular API (v17+).https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22version%3A%20current%20(v17%2B)%22
21.0.0-rc.2https://github.com/angular/angularfire/milestone/30
https://github.com/armando-navarro
armando-navarrohttps://github.com/armando-navarro
on Aug 17, 2026https://github.com/angular/angularfire/issues/3748#issue-5175836677
#3740https://github.com/angular/angularfire/pull/3740
armando-navarrohttps://github.com/armando-navarro
comp: authAuthentication (src/auth).https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20auth%22
comp: ssrServer-side rendering, hydration, @angular/ssr interop.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20ssr%22
comp: zonesChange detection / zone.js / zoneless.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20zones%22
type: bugDefect: expected behavior doesn't happen.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
on Aug 17, 2026https://github.com/angular/angularfire/issues/3748#event-29584514309
armando-navarrohttps://github.com/armando-navarro
on Aug 17, 2026https://github.com/angular/angularfire/issues/3748#event-29584553171
docs(auth): restructure step 2 cookie guidance per reviewhttps://github.com/armando-navarro/angularfire/commit/35d3ac0204a5add2a013187fd9081e4ba07720c8
35d3ac0https://github.com/armando-navarro/angularfire/commit/35d3ac0204a5add2a013187fd9081e4ba07720c8
docs(auth): rewrite the server-side rendering section (#3740)https://github.com/angular/angularfire/commit/5a6dc5e1967fac9d0306785b4e256f1566179cda
#3740https://github.com/angular/angularfire/pull/3740
5a6dc5ehttps://github.com/angular/angularfire/commit/5a6dc5e1967fac9d0306785b4e256f1566179cda
https://github.com/armando-navarro
armando-navarrohttps://github.com/armando-navarro
on Sep 25, 2026https://github.com/angular/angularfire/issues/3748#issuecomment-5826115962
docs/auth.mdhttps://github.com/angular/angularfire/blob/main/docs/auth.md
armando-navarrohttps://github.com/armando-navarro
version: current (v17+)Targets the current modular API (v17+).https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22version%3A%20current%20(v17%2B)%22
on Sep 25, 2026https://github.com/angular/angularfire/issues/3748#event-31807103661
armando-navarrohttps://github.com/armando-navarro
on Sep 27, 2026https://github.com/angular/angularfire/issues/3748#event-31952755636
docs(auth): scope the beforeAuthStateChanged note to rc.1 and earlierhttps://github.com/armando-navarro/angularfire/commit/da1631a7ecf93dd3ae9506406f4d05574da82159
https://docs.github.com/articles/closing-issues-via-commit-messages
da1631ahttps://github.com/armando-navarro/angularfire/commit/da1631a7ecf93dd3ae9506406f4d05574da82159
armando-navarrohttps://github.com/armando-navarro
completedhttps://github.com/angular/angularfire/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3770https://github.com/angular/angularfire/pull/3770
on Sep 27, 2026https://github.com/angular/angularfire/issues/3748#event-31953162887
armando-navarrohttps://github.com/armando-navarro
21.0.0-rc.2https://github.com/angular/angularfire/milestone/30
on Oct 1, 2026https://github.com/angular/angularfire/issues/3748#event-32219556874
riya-amemiyahttps://github.com/riya-amemiya
on Oct 2, 2026https://github.com/angular/angularfire/issues/3748#event-32313478422
fix(auth): stop beforeAuthStateChanged from holding the app unstable (a…https://github.com/riya-amemiya/angularfire/commit/f18297253b3d095844e4c673da63ec3cb5f87abd
a…https://github.com/angular/angularfire/pull/3770
https://docs.github.com/articles/closing-issues-via-commit-messages
f182972https://github.com/riya-amemiya/angularfire/commit/f18297253b3d095844e4c673da63ec3cb5f87abd
armando-navarrohttps://github.com/armando-navarro
on Oct 10, 2026https://github.com/angular/angularfire/issues/3748#event-32922212462
fix(auth): stop beforeAuthStateChanged from holding the app unstable (a…https://github.com/armando-navarro/angularfire/commit/69d94e60204247cce4f264ce99ae9d6f6cc7a41e
a…https://github.com/angular/angularfire/pull/3770
https://docs.github.com/articles/closing-issues-via-commit-messages
69d94e6https://github.com/armando-navarro/angularfire/commit/69d94e60204247cce4f264ce99ae9d6f6cc7a41e
fix(auth): stop beforeAuthStateChanged from holding the app unstable (#…https://github.com/angular/angularfire/commit/cc1fc1523949d1b6a01f63f2b09e647782bebdd4
#…https://github.com/angular/angularfire/pull/3770
https://docs.github.com/articles/closing-issues-via-commit-messages
cc1fc15https://github.com/angular/angularfire/commit/cc1fc1523949d1b6a01f63f2b09e647782bebdd4
armando-navarrohttps://github.com/armando-navarro
on Oct 27, 2026https://github.com/angular/angularfire/issues/3748#event-34383343787
docs: fix the beforeAuthStateChanged import and the Imagen removal no…https://github.com/angular/angularfire/commit/503ce83e7459e28b134d60f4b0bf59414c14ff1a
503ce83https://github.com/angular/angularfire/commit/503ce83e7459e28b134d60f4b0bf59414c14ff1a
docs: fix the beforeAuthStateChanged import and the Imagen removal no…https://github.com/angular/angularfire/commit/c843a36ebcc16ebb4688311cc99fe5639ac11ba6
c843a36https://github.com/angular/angularfire/commit/c843a36ebcc16ebb4688311cc99fe5639ac11ba6
fix: stop twelve wrapped calls from holding the app unstable (#3827)https://github.com/angular/angularfire/commit/c593ecdab539c99fe203b496dd5905d1e4c72623
#3827https://github.com/angular/angularfire/pull/3827
c593ecdhttps://github.com/angular/angularfire/commit/c593ecdab539c99fe203b496dd5905d1e4c72623
armando-navarrohttps://github.com/armando-navarro
on Nov 19, 2026https://github.com/angular/angularfire/issues/3748#event-36610281363
fix: stop twelve wrapped calls from holding the app unstable (#3827)https://github.com/angular/angularfire/commit/a18de0b7ef08b1a2b43c651eab5a6e49647cf5a5
#3827https://github.com/angular/angularfire/pull/3827
a18de0bhttps://github.com/angular/angularfire/commit/a18de0b7ef08b1a2b43c651eab5a6e49647cf5a5
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angularfire/issues/3748
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angularfire/issues/3748
comp: authAuthentication (src/auth).https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20auth%22
comp: ssrServer-side rendering, hydration, @angular/ssr interop.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20ssr%22
comp: zonesChange detection / zone.js / zoneless.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22comp%3A%20zones%22
type: bugDefect: expected behavior doesn't happen.https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
version: current (v17+)Targets the current modular API (v17+).https://github.com/angular/angularfire/issues?q=state%3Aopen%20label%3A%22version%3A%20current%20(v17%2B)%22
21.0.0-rc.2https://github.com/angular/angularfire/milestone/30
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.