Build Error: TypeError related to FinalizationRegistry in Edge Functions

Netlify Site Name: - hollywoodhalls

I’m encountering an issue while deploying my Angular application on Netlify. The build process completes successfully, but the deployment fails during the Edge Functions bundling step. The specific error is related to FinalizationRegistry.

Build Log

8:30:25 PM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
8:30:25 PM: buildbot version: 31384b9071289c6a22c9a280fe11b85737b6fd56
8:30:25 PM: Fetching cached dependencies
8:30:25 PM: Starting to download cache of 157.2MB
8:30:26 PM: Finished downloading cache in 1.6s
8:30:26 PM: Starting to extract cache
8:30:29 PM: Finished extracting cache in 2.297s
8:30:29 PM: Finished fetching cache in 3.957s
8:30:29 PM: Starting to prepare the repo for build
8:30:29 PM: Preparing Git Reference pull/55/head
8:30:31 PM: Starting to install dependencies
8:30:31 PM: Python version set to 3.8
8:30:32 PM: Attempting Ruby version 2.7.2, read from environment
8:30:32 PM: Using Ruby version 2.7.2
8:30:33 PM: Started restoring cached go cache
8:30:33 PM: Finished restoring cached go cache
8:30:34 PM: go version go1.19.13 linux/amd64
8:30:35 PM: Using PHP version 8.0
8:30:37 PM: Started restoring cached Node.js version
8:30:38 PM: Finished restoring cached Node.js version
8:30:38 PM: v18.20.4 is already installed.
8:30:38 PM: Now using node v18.20.4 (npm v10.7.0)
8:30:38 PM: Enabling Node.js Corepack
8:30:38 PM: Started restoring cached build plugins
8:30:38 PM: Finished restoring cached build plugins
8:30:38 PM: Started restoring cached corepack dependencies
8:30:38 PM: Finished restoring cached corepack dependencies
8:30:38 PM: No npm workspaces detected
8:30:38 PM: Started restoring cached node modules
8:30:38 PM: Finished restoring cached node modules
8:30:38 PM: Installing npm packages using npm version 10.7.0
8:30:39 PM: npm warn using --force Recommended protections disabled.
8:30:41 PM: added 37 packages, removed 113 packages, changed 11 packages, and audited 1091 packages in 3s
8:30:41 PM: 150 packages are looking for funding
8:30:41 PM:   run `npm fund` for details
8:30:41 PM: found 0 vulnerabilities
8:30:41 PM: npm notice
8:30:41 PM: npm notice New minor version of npm available! 10.7.0 -> 10.8.3
8:30:41 PM: npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
8:30:41 PM: npm notice To update run: npm install -g npm@10.8.3
8:30:41 PM: npm notice
8:30:41 PM: npm packages installed
8:30:42 PM: Successfully installed dependencies
8:30:42 PM: Starting build script
8:30:43 PM: Detected 1 framework(s)
8:30:43 PM: "angular" at version "18.2.3"
8:30:43 PM: Section completed: initializing
8:30:45 PM: ​
8:30:45 PM: Netlify Build                                                 
8:30:45 PM: ────────────────────────────────────────────────────────────────
8:30:45 PM: ​
8:30:45 PM: ❯ Version
8:30:45 PM:   @netlify/build 29.54.0
8:30:45 PM: ​
8:30:45 PM: ❯ Flags
8:30:45 PM:   accountId: 5f672f83d18439031d28980e
8:30:45 PM:   baseRelDir: true
8:30:45 PM:   buildId: 66dddf230d8aab000973c1d8
8:30:45 PM:   deployId: 66dddf230d8aab000973c1da
8:30:45 PM: ​
8:30:45 PM: ❯ Current directory
8:30:45 PM:   /opt/build/repo
8:30:45 PM: ​
8:30:45 PM: ❯ Config file
8:30:45 PM:   No config file was defined: using default values.
8:30:45 PM: ​
8:30:45 PM: ❯ Context
8:30:45 PM:   deploy-preview
8:30:45 PM: ​
8:30:45 PM: ❯ Loading plugins
8:30:45 PM:    - @netlify/angular-runtime@2.1.0 from Netlify app
8:30:46 PM: ​
8:30:46 PM: Build command from Netlify app                                
8:30:46 PM: ────────────────────────────────────────────────────────────────
8:30:46 PM: ​
8:30:46 PM: $ CI= npm run build
8:30:46 PM: > unity@0.0.0 build
8:30:46 PM: > ng build
8:30:47 PM: ❯ Building...
8:31:06 PM: ✔ Building...
8:31:06 PM: Browser bundles
8:31:06 PM: Initial chunk files     | Names               |  Raw size | Estimated transfer size
8:31:06 PM: main-6SXYTM2P.js        | main                |   1.06 MB |               240.79 kB
8:31:06 PM: styles-R6UBXF4R.css     | styles              | 697.66 kB |                38.56 kB
8:31:06 PM: chunk-ETABVS4A.js       | -                   | 175.75 kB |                42.59 kB
8:31:06 PM: polyfills-MH5IBZ74.js   | polyfills           |  34.54 kB |                11.35 kB
8:31:06 PM:                         | Initial total       |   1.97 MB |               333.28 kB
8:31:06 PM: Lazy chunk files        | Names               |  Raw size | Estimated transfer size
8:31:06 PM: chunk-W6YATKXO.js       | index-esm           |  29 bytes |                29 bytes
8:31:06 PM: Server bundles
8:31:06 PM: Initial chunk files     | Names               |  Raw size
8:31:06 PM: chunk-ZGMJWUZG.mjs      | -                   |   1.11 MB | 
8:31:06 PM: server.mjs              | server              |   1.10 MB | 
8:31:06 PM: chunk-JNZ5CLHO.mjs      | -                   | 546.11 kB | 
8:31:06 PM: chunk-JA6YF543.mjs      | -                   | 542.39 kB | 
8:31:06 PM: polyfills.server.mjs    | polyfills.server    | 268.61 kB | 
8:31:06 PM: chunk-EXD34EPT.mjs      | -                   |   2.87 kB | 
8:31:06 PM: chunk-W6O7R4GF.mjs      | -                   |   2.30 kB | 
8:31:06 PM: render-utils.server.mjs | render-utils.server | 252 bytes | 
8:31:06 PM: main.server.mjs         | main.server         | 207 bytes | 
8:31:06 PM: Lazy chunk files        | Names               |  Raw size
8:31:06 PM: chunk-UX7DM3OC.mjs      | xhr2                |  12.08 kB | 
8:31:06 PM: chunk-YQIIFZC6.mjs      | index               | 121 bytes | 
8:31:06 PM: Application bundle generation complete. [18.871 seconds]
8:31:06 PM: Output location: /opt/build/repo/dist/Unity
8:31:06 PM: ​
8:31:06 PM: (build.command completed in 19.7s)
8:31:06 PM: Writing Angular SSR Edge Function ...
8:31:06 PM: ​
8:31:06 PM: Edge Functions bundling                                       
8:31:06 PM: ────────────────────────────────────────────────────────────────
8:31:06 PM: ​
8:31:06 PM: Packaging Edge Functions from .netlify/edge-functions directory:
8:31:06 PM:  - angular-ssr
8:31:13 PM: TypeError: Cannot read properties of undefined (reading 'FinalizationRegistry')
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-JA6YF543.mjs:2:31224
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-EXD34EPT.mjs:2:1078
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-JA6YF543.mjs:39:10316
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-EXD34EPT.mjs:2:1078
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-JA6YF543.mjs:45:4459
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-EXD34EPT.mjs:2:1078
8:31:13 PM:     at file:///opt/build/repo/dist/Unity/server/chunk-JA6YF543.mjs:51:45
8:31:13 PM: ​
8:31:13 PM: Bundling of edge function failed                              
8:31:13 PM: ────────────────────────────────────────────────────────────────
8:31:13 PM: ​
8:31:13 PM:   Error message
8:31:13 PM:   Could not load edge function at '/opt/build/repo/.netlify/edge-functions/angular-ssr/angular-ssr.mjs'. More on the Edge Functions API at https://ntl.fyi/edge-api.
8:31:13 PM: ​
8:31:13 PM:   Error location
8:31:13 PM:   While bundling edge function
8:31:13 PM: ​
8:31:13 PM:   Resolved config
8:31:13 PM:   build:
8:31:13 PM:     command: CI= npm run build
8:31:13 PM:     commandOrigin: ui
8:31:13 PM:     environment:
8:31:13 PM:       - CI
8:31:13 PM:       - NPM_FLAGS
8:31:13 PM:       - REVIEW_ID
8:31:13 PM:     publish: /opt/build/repo/dist/Unity/browser
8:31:13 PM:     publishOrigin: ui
8:31:13 PM:   plugins:
8:31:13 PM:     - inputs: {}
8:31:13 PM:       origin: ui
8:31:13 PM:       package: '@netlify/angular-runtime'
8:31:13 PM:   redirects:
8:31:14 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:31:14 PM:     - from: /*
      status: 200
      to: /index.html
8:31:14 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:31:14 PM: Failing build: Failed to build site
8:31:14 PM: Finished processing build request in 49.595s

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "Unity": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        },
        "@schematics/angular:application": {
          "strict": true
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            "outputPath": "dist/Unity",
            "index": "src/index.html",
            "polyfills": [
              "src/polyfills.ts"
            ],
            "tsConfig": "tsconfig.app.json",
            "inlineStyleLanguage": "scss",
            "allowedCommonJsDependencies": [
              "rxjs-compat",
              "lodash",
              "moment",
              "undici",
              "@grpc/grpc-js",
              "@grpc/proto-loader"
            ],
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/_redirects",
              "src/sw.js"
            ],
            "styles": [
              "src/styles.scss",
              "node_modules/bulma/css/bulma.css",
              "node_modules/ngx-toastr/toastr.css"
            ],
            "scripts": [],
            "browser": "src/main.ts",
            "server": "src/main.server.ts",
            "prerender": false,
            "ssr": {
              "entry": "server.ts"
            }
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2.5mb",
                  "maximumError": "2.5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "optimization": false,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "buildTarget": "Unity:build:production"
            },
            "development": {
              "buildTarget": "Unity:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "buildTarget": "Unity:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.scss"
            ],
            "scripts": []
          }
        }
      }
    }
  }
}

hi, sorry we missed this. Are you still experiencing your build issues?