Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR error appears on each page: TypeError: Cannot read properties of undefined (reading 'userAgent') #3000

Closed
tdonohue opened this issue May 2, 2024 · 2 comments · Fixed by #3004
Assignees
Labels
bug high priority testathon Reported by a tester during Community Testathon
Milestone

Comments

@tdonohue
Copy link
Member

tdonohue commented May 2, 2024

Describe the bug
After merging #2976, any time you run the UI in production mode, the following Server-side rendering error occurs:

ERROR TypeError: Cannot read properties of undefined (reading 'userAgent')
    at RootComponent2.getBrowserName (C:\dspace-angular\dist\server\main.js:1:1008203)
    at RootComponent2.ngOnInit (C:\dspace-angular\dist\server\main.js:1:1006659)
    at callHookInternal (C:\dspace-angular\dist\server\main.js:1:4136369)
    at callHook (C:\dspace-angular\dist\server\main.js:1:4136729)
    at callHooks (C:\dspace-angular\dist\server\main.js:1:4136119)
    at executeInitAndCheckHooks (C:\dspace-angular\dist\server\main.js:1:4135456)
    at refreshView (C:\dspace-angular\dist\server\main.js:1:4207799)
    at detectChangesInView$1 (C:\dspace-angular\dist\server\main.js:1:4211075)
    at detectChangesInViewIfAttached (C:\dspace-angular\dist\server\main.js:1:4210634)
    at detectChangesInEmbeddedViews (C:\dspace-angular\dist\server\main.js:1:4210339)

The issue appears to be on this line: https://github.com/DSpace/dspace-angular/blob/main/src/app/root/root.component.ts#L147

To Reproduce
Steps to reproduce the behavior:

  1. Start the UI in production mode: yarn install; yarn build:prod; yarn serve:ssr
  2. Access the homepage (or any page). In the console where you ran yarn serve:ssr, you'll see the above TypeError.
@tdonohue tdonohue added bug high priority testathon Reported by a tester during Community Testathon labels May 2, 2024
@tdonohue tdonohue added this to the 8.0 milestone May 2, 2024
@github-project-automation github-project-automation bot moved this to 📋 To Do in DSpace 8.0 Release May 2, 2024
@tdonohue
Copy link
Member Author

tdonohue commented May 2, 2024

@davide-negretti : This is a bug that is caused by #2976. It's likely a simple fix. If you have time to work on a PR, I'd appreciate it.

@tdonohue
Copy link
Member Author

tdonohue commented May 3, 2024

Nevermind, I figured out the fix myself. It was simple after all. See #3004

@tdonohue tdonohue self-assigned this May 3, 2024
@tdonohue tdonohue moved this from 📋 To Do to 🙋 Needs Reviewers Assigned in DSpace 8.0 Release May 3, 2024
@tdonohue tdonohue moved this from 🙋 Needs Reviewers Assigned to 🏗 In Progress in DSpace 8.0 Release May 3, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in DSpace 8.0 Release May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug high priority testathon Reported by a tester during Community Testathon
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant