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

Angular Universal server-side: ReferenceError: navigator is not defined #251

Closed
stephencawood opened this issue Apr 4, 2018 · 2 comments · Fixed by #248
Closed

Angular Universal server-side: ReferenceError: navigator is not defined #251

stephencawood opened this issue Apr 4, 2018 · 2 comments · Fixed by #248
Labels
Milestone

Comments

@stephencawood
Copy link

stephencawood commented Apr 4, 2018

Bug Report or Feature Request (mark with an x)

- [ x] bug report 
- [ ] feature request
- [ ] question

OS and Version?

macOS and Linux

Versions

ngx-share/buttons: "5.2.0"

Angular CLI: 1.6.3
Node: 7.9.0
OS: darwin x64
Angular: 5.2.8
... animations, common, compiler, core, forms, http
... platform-browser, platform-browser-dynamic, platform-server, router
angular/cdk: 5.2.4
angular/cli: 1.6.3
angular/compiler-cli: 5.2.3
angular/flex-layout: 5.0.0-beta.13
angular/material: 5.2.4
angular-devkit/build-optimizer: 0.0.36
angular-devkit/core: 0.0.22
angular-devkit/schematics: 0.0.42
ngtools/json-schema: 1.1.0
ngtools/webpack: 1.9.3
schematics/angular: 0.1.11
schematics/schematics: 0.0.11
typescript: 2.7.1
webpack: 3.10.0

Repro steps

Add ngx-share-buttons (e.g., <share-buttons [url]=url [size]="-2">) to a component and run Angular Universal Server-side. The error does not appear in the browser console.

The log given by the failure

ReferenceError: navigator is not defined
at getOS (/app/dist/server.js:70666)
at ShareButtons (/app/dist/server.js:70534)
at ShareButtonsFactory (/app/dist/server.js:184401)
at _callFactory (/app/dist/server.js:11207)
at createProviderInstance$1 (/app/dist/server.js:11159)
at resolveNgModuleDep (/app/dist/server.js:11141)
at NgModuleRef
.get (/app/dist/server.js:12378)
at resolveDep (/app/dist/server.js:12868)
at createClass (/app/dist/server.js:12730)

Desired functionality

No error

Mention any other details that might be useful

The error above is from today. Is anyone else seeing this error running server-side Angular Universal (v5)? There is no error in the browser, so it only appears in the console if you're running an SSR universal build. I can see it in my dev environment and in error reporting on Google Cloud Platform (App Engine). The error does not stop all the share buttons from working. For example, Twitter and Facebook seem to still work. However, the error does prevent other server-side components from functioning properly so I've had to remove ngx-sharebuttons until it's resolved.

@MurhafSousli
Copy link
Owner

@stephencawood It should be fixed in 5.3.0

@stephencawood
Copy link
Author

stephencawood commented Apr 11, 2018

Thanks! I've confirmed that it's fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants