Angular Universal SSR not working without builder - @angular/fire:deploy builder cloud functions folder different from default #2773
              
                Unanswered
              
          
                  
                    
                      sanderschnydrig
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello World
I've been struggling for days now to get Angular Universal working on Firebase with Angular 11.2.3 and the latest version of AngularFire namely 6.1.4 in a fresh blank project.
The steps I used to create the project and schematics are:
ng new rro-ssr --strict --routing=true --style=sassng add @nguniversal/express-enginefirebase initng add @angular/fireIf I'm using
ng deployand check out the hosting site it works fine, Angular Universal is doing the Server-Side rendering.But why is there no way to specify the Cloud Functions folder inside Angular? The project I am working on already has Cloud Functions in the default folder called
functionsin the root directory of the Angular application. Also the generated Cloud Functions from the AngularFire SSR builder are using Javascript while our project is using Typescript.As it is, I cannot define two separate folders for Firebase Cloud Functions, and I don't want the
@angular/fire:deploybuilder to overwrite my existing Cloud Functions.Furthermore, if I'm trying to deploy the npm scripts made by Angular Universal (parts of the process are described here https://github.com/angular/angularfire/blob/master/docs/universal/cloud-functions.md ), it somehow is not executing the rewrite as described in the link.
firebase.json{ "functions": { "source": "functions" }, "hosting": [ { "target": "rro-ssr", "public": "functions\\dist\\rro-ssr\\browser", "ignore": [ "**/.*" ], "headers": [ { "source": "*.[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].+(css|js)", "headers": [ { "key": "Cache-Control", "value": "public,max-age=31536000,immutable" } ] } ], "rewrites": [ { "source": "**", "function": "ssr" } ] } ] }I was using the link in the "Additional Resources" from Fireship: https://fireship.io/lessons/angular-universal-firebase/
Cloud Function
functions/src/index.tsProblem: Even if I just copy everything the
@angular/fire:deploybuilder is putting inside thedist/{project-name}folder and executingfirebase deploy, it's not doing the SSR on the hosting site, if I'm building and deploying manually, and not using the AngularFire SSR builder.The npm script that I'm using in my
package.json:"deploy": "npm run build:ssr && npm run --prefix functions build:ssr && firebase deploy",The npm script that I'm using in my
functions/package.json:"build:ssr": "node cp-angular.js && tsc",The copy script
functions/cp-angular.js:Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions