Skip to content

SSR builder fails to deploy: generated configuration doesn't match the schema #3074

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

Closed
Supamiu opened this issue Nov 23, 2021 · 3 comments
Closed

Comments

@Supamiu
Copy link

Supamiu commented Nov 23, 2021

Version info

Angular: 12.2.13

Firebase: 9.5.0

AngularFire: 7.2.0

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

Cannot be reproduced inside stackblitz as it's an issue with ng deploy.

Steps to set up and reproduce

  • Create a project that uses @angular/fire, add it using ng add
  • Enable SSR deployment in the configuration prompts
  • Run ng deploy
  • Error shows up

Sample data and security rules

Full deploy configuration:

       {
          "builder": "@angular/fire:deploy",
          "options": {
            "ssr": "cloud-functions",
            "prerender": false,
            "firebaseProject": "<projectName>",
            "firebaseHostingSite": "<projectName>",
            "functionName": "ssr_<projectName>",
            "functionsNodeVersion": "16",
            "region": "us-central1",
            "browserTarget": "guides:build:production",
            "serverTarget": "guides:server:production",
            "prerenderTarget": "guides:prerender:production",
            "outputPath": "dist/guides/functions"
          }
        }

Debug output

** Errors in the JavaScript console **

Property 'ssr' does not match the schema. 'true' should be a 'boolean,string'.

Expected behavior

The app should build and deploy properly inside the cloud function.

Actual behavior

Builder doesn't start because the schema doesn't match.

@Supamiu
Copy link
Author

Supamiu commented Nov 28, 2021

For anyone getting this issue, the only fix I found was to replace the content of node_modules/@angular/fire/schematics/deploy/schema.json

With this schema:

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "FirebaseDeploySchema",
  "title": "Firebase Deploy",
  "description": "Ng Deploy target options for Firebase.",
  "properties": {
    "buildTarget": {
      "type": "string",
      "description": "Target to build.",
      "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
    },
    "browserTarget": {
      "type": "string",
      "description": "Target to build.",
      "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
    },
    "prerenderTarget": {
      "type": "string",
      "description": "Target to build.",
      "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
    },
    "serverTarget": {
      "type": "string",
      "description": "Target to build.",
      "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
    },
    "universalBuildTarget": {
      "type": "string",
      "description": "Target to build.",
      "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
    },
    "ssr": {
      "type": "boolean",
      "description": "Should we attempt to deploy the function to Cloud Functions (true or 'cloud-functions') / Cloud Run ('cloud-run') or just Hosting (false)"
    },
    "prerender": {
      "type": "boolean",
      "description": "Prerender before deploy?"
    },
    "firebaseProject": {
      "type": "string",
      "description": "The Firebase project name or project alias to use when deploying"
    },
    "target": {
      "type": "string",
      "description": "The Firebase hosting target in firebase.json for multi-site"
    },
    "firebaseHostingSite": {
      "type": "string",
      "description": "The Firebase Hosting site to deploy to"
    },
    "functionName": {
      "type": "string",
      "description": "The name of the Cloud Function or Cloud Run serviceId to deploy SSR to"
    },
    "functionsNodeVersion": {
      "type": "number",
      "description": "Version of Node.js to run Cloud Functions / Run on"
    },
    "region": {
      "type": "string",
      "description": "The region to deploy Cloud Functions or Cloud Run to"
    },
    "outputPath": {
      "type": "string",
      "description": "Where to output the deploy artifacts"
    },
    "functionsRuntimeOptions": {
      "type": "object",
      "description": "Runtime options for Cloud Functions, if deploying to Cloud Functions"
    },
    "preview": {
      "type": "boolean",
      "description": "Do not deploy the application, just set up the Firebase Function in the project output directory. Can be used for testing the Firebase Function with `firebase serve`."
    },
    "cloudRunOptions": {
      "type": "object",
      "description": "Options passed to Cloud Run, if deploying to Cloud Run.",
      "properties": {
        "cpus": {
          "type": "number",
          "description": "Set a CPU limit in Kubernetes cpu units."
        },
        "maxConcurrency": {
          "type": "number",
          "pattern": "^(\\d+|default)$",
          "description": "Set the maximum number of concurrent requests allowed per container instance. If concurrency is unspecified, any number of concurrent requests are allowed. To unset this field, provide the special value default."
        },
        "maxInstances": {
          "type": "number",
          "pattern": "^(\\d+|default)$",
          "description": "The maximum number of container instances of the Service to run. Use 'default' to unset the limit and use the platform default."
        },
        "memory": {
          "type": "string",
          "pattern": "^\\d+(G|M)i$",
          "description": "Set a memory limit. Ex: 1Gi, 512Mi."
        },
        "minInstances": {
          "type": "number",
          "pattern": "^(\\d+|default)$",
          "description": "The minimum number of container instances of the Service to run or 'default' to remove any minimum."
        },
        "timeout": {
          "type": "number",
          "description": "Set the maximum request execution time (timeout) in seconds."
        },
        "vpcConnector": {
          "type": "string",
          "description": "Set a VPC connector for this resource."
        }
      }
    }
  }
}

@mackelito
Copy link

I'm also seeing this error

    "deploy": {
      "executor": "@angular/fire:deploy",
      "options": {
        "prerender": false,
        "ssr": false,
        "browserTarget": "website:build:production",
        "firebaseProject": "site-2d235",
        "firebaseHostingSite": "site-2d235"
      }
    }

@jamesdaniels
Copy link
Member

Cutting 7.2.1 with the fix now

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

No branches or pull requests

3 participants