question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSR not working with ng

See original GitHub issue

Versions

Angular CLI: 6.0.0
Node: 8.11.0
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

Observed behavior

A 500 errors occurs

TypeError: StaticInjectorError[InjectionToken Application Initializer -> InjectionToken DocumentToken]:
  StaticInjectorError(Platform: core)[InjectionToken Application Initializer -> InjectionToken DocumentToken]:
    Right-hand side of 'instanceof' is not an object
    at bt (/Users/dannyblue/Documents/projects/foo/dist/server.js:1182:87380)
    at gt (/Users/dannyblue/Documents/projects/foo/dist/server.js:1182:87255)
    at ir (/Users/dannyblue/Documents/projects/foo/dist/server.js:1182:110026)

Desired behavior

App is served correctly

Mention any other details that might be useful (optional)

This works fine with Angular 6 and Angular CLI 1.7 but fails with Angular 6 and Angular CLI 6.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:21
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
paulogrcommented, May 5, 2018

I did solve this issue changing my webpack.server.config.js mode to development instead of production

Hope it helps

Angular CLI: 6.0.0
Node: 8.9.4
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.7.0
7reactions
johnzondrcommented, Sep 7, 2018

Hey guys,

Similar to what @paulogr said, this error occurred for me when webpack minimizes the file (production mode). By turning minimization off, the 500 error no longer occurs.

My webpack config: https://gist.github.com/johnzondr/3d4a361ffcfe89f7ee5199dcc13bf246

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSR is not working on project build with angular 11
In my application, I fetching HTML data from the API and render it, but when I trying to do view the source after...
Read more >
Server side rendering with universal · Issue #858 - GitHub
Please let us know about SSR work. I have this error: /node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.js:1 (function ( ...
Read more >
Server-side rendering (SSR) with Angular Universal
This guide describes Angular Universal, a technology that renders Angular applications on the server. A normal Angular application executes in the browser, ...
Read more >
How to build an Angular App with Server-Side Rendering
First run npm run build:ssr and when that is completed, run npm run serve:ssr . Your application should be served on localhost:4201. Transfer...
Read more >
Angular Universal: Complete Practical Guide
This post will be a complete practical guide for getting started with Angular Universal. We are going to go start with an existing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found