René's URL Explorer Experiment


Title: Angular 16 migration: TypeError: Cannot read properties of undefined (reading 'getElementById') · Issue #50138 · angular/angular · GitHub

Open Graph Title: Angular 16 migration: TypeError: Cannot read properties of undefined (reading 'getElementById') · Issue #50138 · angular/angular

X Title: Angular 16 migration: TypeError: Cannot read properties of undefined (reading 'getElementById') · Issue #50138 · angular/angular

Description: Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description Migrating from angular 15.2.9 to 16.0.0 we encounter the stack trace below when running the universal server (dev & prod buil...

Open Graph Description: Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description Migrating from angular 15.2.9 to 16.0.0 we encounter the stack trace below when runni...

X Description: Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description Migrating from angular 15.2.9 to 16.0.0 we encounter the stack trace below when r...

Opengraph URL: https://github.com/angular/angular/issues/50138

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular 16 migration: TypeError: Cannot read properties of undefined (reading 'getElementById')","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nDon't known / other\n\n### Is this a regression?\n\nNo\n\n### Description\n\nMigrating from angular 15.2.9 to 16.0.0 we encounter the stack trace below when running the universal server (dev & prod build).\r\nspa dev mode works as expected without any noticeable issues. \r\nFollowing the stack trace it's this piece of code that is encountering an issue:\r\n```js\r\nfunction retrieveTransferredState(doc,appId){const script=doc.getElementById(appId+\"-state\");\r\n```\r\nThe error occurs whether we provide client hydration or not. \r\nWe use TransferState throughout the application to send data from ssr to the client. \r\n\r\nEnvironmentService, that seems to be the root of this error, injects TransferState in the constructor.\r\n\r\nI don't quite know how to drill down on this issue, since this seems to be happening very early in app lifecycle. Any Idea on how to create a reproduction would be highly appreciated. \n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n```true\nTypeError: Cannot read properties of undefined (reading 'getElementById')\r\n    at retrieveTransferredState (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2325653)\r\n    at Object.initTransferState [as factory] (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2324438)\r\n    at R3Injector.hydrate (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2320111)\r\n    at R3Injector.get (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2318370)\r\n    at injectInjectorOnly (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2186545)\r\n    at Object.ɵɵinject (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2186715)\r\n    at Object.EnvironmentService_Factory [as factory] (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:27288)\r\n    at R3Injector.hydrate (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2320111)\r\n    at R3Injector.get (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2318370)\r\n    at injectInjectorOnly (/home/marco/FollowAlice/referral/frontend/dist/referral/server/main.js:1:2186545)\n```\n\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI: 16.0.0\r\nNode: 18.16.0\r\nPackage Manager: npm 9.5.1\r\nOS: linux x64\r\n\r\nAngular: 16.0.0\r\n... animations, cdk, cli, common, compiler, compiler-cli, core\r\n... forms, language-service, material, material-luxon-adapter\r\n... platform-browser, platform-browser-dynamic, platform-server\r\n... router, service-worker, youtube-player\r\n\r\nPackage                         Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect       0.1600.0\r\n@angular-devkit/build-angular   16.0.0\r\n@angular-devkit/core            16.0.0\r\n@angular-devkit/schematics      16.0.0\r\n@nguniversal/builders           16.0.0\r\n@nguniversal/express-engine     16.0.0\r\n@schematics/angular             16.0.0\r\ntypescript                      4.9.5\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/MarcoGlauser","@type":"Person","name":"MarcoGlauser"},"datePublished":"2023-05-04T06:50:07Z","url":"https://github.com/angular/angular/issues/50138"}

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:564a7262-6dd5-bec8-b1c5-3d5f75d3ff88
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCE02:3D8CBB:192767B:212B046:6B013FE3
html-safe-noncef8e9426aa5adc52736b8accc1833e84b65b61d2c7c7690ada4009baf2fa37b93
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTAyOjNEOENCQjoxOTI3NjdCOjIxMkIwNDY6NkIwMTNGRTMiLCJ2aXNpdG9yX2lkIjoiODMyODczNzU4MzYxODE0NjI3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7cafb6787ba591de962676d4a3ba856f1f23a5469a8b6111ef000a762fc5b8f6
hovercard-subject-tagissue:1695363636
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/angular/50138/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3913df6edc358a70ab5d4378cb47275e2c4210e24eae51c3cdcdf8bce04ba595/angular/angular/issues/50138
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3913df6edc358a70ab5d4378cb47275e2c4210e24eae51c3cdcdf8bce04ba595/angular/angular/issues/50138
og:image:altWhich @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description Migrating from angular 15.2.9 to 16.0.0 we encounter the stack trace below when runni...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameMarcoGlauser
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/50138#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F50138
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%2Fangular%2Fissues%2F50138
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%2Fangular
Reloadhttps://github.com/angular/angular/issues/50138
Reloadhttps://github.com/angular/angular/issues/50138
Reloadhttps://github.com/angular/angular/issues/50138
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/50138
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/50138
Angular 16 migration: TypeError: Cannot read properties of undefined (reading 'getElementById')https://github.com/angular/angular/issues/50138#top
https://github.com/alan-agius4
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: serverIssues related to server-side renderinghttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20server%22
core: hydrationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20hydration%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/MarcoGlauser
MarcoGlauserhttps://github.com/MarcoGlauser
on May 4, 2023https://github.com/angular/angular/issues/50138#issue-1695363636
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
area: serverIssues related to server-side renderinghttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20server%22
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9163467821
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9163467978
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on May 4, 2023https://github.com/angular/angular/issues/50138#issuecomment-1534184921
@alan-agius4https://github.com/alan-agius4
https://github.com/alan-agius4
alan-agius4https://github.com/alan-agius4
on May 4, 2023https://github.com/angular/angular/issues/50138#issuecomment-1534302236
https://github.com/angular/angular/blob/2419c486ad8a3129d27ade6852e33d1435512da1/packages/core/src/transfer_state.ts#LL75C50-L75C61https://github.com/angular/angular/blob/2419c486ad8a3129d27ade6852e33d1435512da1/packages/core/src/transfer_state.ts#LL75C50-L75C61
angular/packages/core/src/render3/interfaces/document.tshttps://github.com/angular/angular/blob/2419c486ad8a3129d27ade6852e33d1435512da1/packages/core/src/render3/interfaces/document.ts#L44-L56
2419c48https://github.com/angular/angular/commit/2419c486ad8a3129d27ade6852e33d1435512da1
angular/packages/platform-server/src/server.tshttps://github.com/angular/angular/blob/2419c486ad8a3129d27ade6852e33d1435512da1/packages/platform-server/src/server.ts#L68-L80
2419c48https://github.com/angular/angular/commit/2419c486ad8a3129d27ade6852e33d1435512da1
alan-agius4https://github.com/alan-agius4
needs reproductionThis issue needs a reproduction in order for the team to investigate furtherhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22needs%20reproduction%22
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9164418166
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9164418480
https://github.com/MarcoGlauser
MarcoGlauserhttps://github.com/MarcoGlauser
on May 4, 2023https://github.com/angular/angular/issues/50138#issuecomment-1534471961
https://github.com/MarcoGlauser/16-migration-reprohttps://github.com/MarcoGlauser/16-migration-repro
MarcoGlauser/16-migration-repro@4225768https://github.com/MarcoGlauser/16-migration-repro/commit/4225768a2552fd9be347bb5f90694383b479ff28
https://github.com/alan-agius4
alan-agius4https://github.com/alan-agius4
on May 4, 2023https://github.com/angular/angular/issues/50138#issuecomment-1534867999
https://github.com/angular/angular/blob/2419c486ad8a3129d27ade6852e33d1435512da1/packages/core/src/transfer_state.ts#LL75C50-L75C61https://github.com/angular/angular/blob/2419c486ad8a3129d27ade6852e33d1435512da1/packages/core/src/transfer_state.ts#LL75C50-L75C61
@AndrewKushnirhttps://github.com/AndrewKushnir
alxhubhttps://github.com/alxhub
core: hydrationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20hydration%22
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9168058080
AndrewKushnirhttps://github.com/AndrewKushnir
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9170360926
alan-agius4https://github.com/alan-agius4
needs reproductionThis issue needs a reproduction in order for the team to investigate furtherhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22needs%20reproduction%22
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9170652301
alan-agius4https://github.com/alan-agius4
on May 4, 2023https://github.com/angular/angular/issues/50138#event-9170652462
alxhubhttps://github.com/alxhub
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
a684888https://github.com/angular/angular/commit/a684888af7e1fbcf53aec8619382ee6c6d16927d
on May 8, 2023https://github.com/angular/angular/issues/50138#event-9194669715
alxhubhttps://github.com/alxhub
on May 8, 2023https://github.com/angular/angular/issues/50138#event-9194669787
fix(core): only try to retrieve transferred state on the browser (#50144https://github.com/angular/angular/commit/346ab73dd95fd2adfd8cb4064b9f12a6171e51d5
#50144https://github.com/angular/angular/pull/50144
https://docs.github.com/articles/closing-issues-via-commit-messages
346ab73https://github.com/angular/angular/commit/346ab73dd95fd2adfd8cb4064b9f12a6171e51d5
jessicajaniukhttps://github.com/jessicajaniuk
on May 19, 2023https://github.com/angular/angular/issues/50138#event-9291022001
docs: added clarity in lifecycle event docs (#50145)https://github.com/angular/angular/commit/d963ecdf5057e68701f44dd9dabe0f45f9f9e5b7
#50145https://github.com/angular/angular/pull/50145
https://docs.github.com/articles/closing-issues-via-commit-messages
d963ecdhttps://github.com/angular/angular/commit/d963ecdf5057e68701f44dd9dabe0f45f9f9e5b7
docs: added clarity in lifecycle event docs (#50145)https://github.com/angular/angular/commit/2f1796f8f6299d78de7e286e5b836d8402bb7661
#50145https://github.com/angular/angular/pull/50145
https://docs.github.com/articles/closing-issues-via-commit-messages
2f1796fhttps://github.com/angular/angular/commit/2f1796f8f6299d78de7e286e5b836d8402bb7661
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jun 8, 2023https://github.com/angular/angular/issues/50138#issuecomment-1581677997
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jun 8, 2023https://github.com/angular/angular/issues/50138#event-9465449171
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/50138
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/50138
alan-agius4https://github.com/alan-agius4
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: serverIssues related to server-side renderinghttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20server%22
core: hydrationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20hydration%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
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

Viewport: width=device-width


URLs of crawlers that visited me.