Home
Support Forums

triggerUncaughtException when deploying next.js project

Hello, I am trying to deploy my website, but it now all of a sudden is not working. It had been previously working and I even tried redeploying an older branch from git, but I am still running into an error. I am attaching the log below

8:42:12 PM: Build ready to start
8:42:14 PM: build-image version: c5b01a919d3e16af69445c5de0cacb49efbb1a23 (focal)
8:42:14 PM: build-image tag: v4.4.0
8:42:14 PM: buildbot version: 0ada244ab84a1759a70d6b2cfc27c9987b5c77ca
8:42:14 PM: Building without cache
8:42:14 PM: Starting to prepare the repo for build
8:42:14 PM: No cached dependencies found. Cloning fresh repo
8:42:14 PM: git clone https://github.com/princeisamaliya/palasino
8:42:15 PM: Preparing Git Reference refs/heads/master
8:42:16 PM: Parsing package.json dependencies
8:42:16 PM: Starting build script
8:42:16 PM: Installing dependencies
8:42:16 PM: Python version set to 2.7
8:42:17 PM: Downloading and installing node v16.13.0...
8:42:17 PM: Downloading https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz...
8:42:18 PM: Computing checksum with sha256sum
8:42:18 PM: Checksums matched!
8:42:21 PM: Now using node v16.13.0 (npm v8.1.0)
8:42:21 PM: Started restoring cached build plugins
8:42:21 PM: Finished restoring cached build plugins
8:42:21 PM: Attempting ruby version 2.7.2, read from environment
8:42:22 PM: Using ruby version 2.7.2
8:42:22 PM: Using PHP version 8.0
8:42:22 PM: Started restoring cached yarn cache
8:42:22 PM: Finished restoring cached yarn cache
8:42:22 PM: Installing yarn at version 1.22.10
8:42:22 PM: Installing Yarn!
8:42:22 PM: > Downloading tarball...
8:42:22 PM: [1/2]: https://yarnpkg.com/downloads/1.22.10/yarn-v1.22.10.tar.gz --> /tmp/yarn.tar.gz.U478FiPn6G
8:42:22 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
8:42:22 PM:                                  Dload  Upload   Total   Spent    Left  Speed
8:42:23 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
8:42:23 PM: 100    81  100    81    0     0    632      0 --:--:-- --:--:-- --:--:--   632
8:42:23 PM: 100    95  100    95    0     0    266      0 --:--:-- --:--:-- --:--:--   266
8:42:23 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
8:42:23 PM: 100   626  100   626    0     0   1343      0 --:--:-- --:--:-- --:--:--  6955
8:42:23 PM: 100 1215k  100 1215k    0     0  2016k      0 --:--:-- --:--:-- --:--:-- 2016k
8:42:23 PM: [2/2]: https://yarnpkg.com/downloads/1.22.10/yarn-v1.22.10.tar.gz.asc --> /tmp/yarn.tar.gz.U478FiPn6G.asc
8:42:23 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
8:42:23 PM:                                  Dload  Upload   Total   Spent    Left  Speed
8:42:23 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
8:42:23 PM: 100    85  100    85    0     0   1370      0 --:--:-- --:--:-- --:--:--  1370
8:42:23 PM: 100    99  100    99    0     0   1031      0 --:--:-- --:--:-- --:--:--  1031
8:42:23 PM: 100   630  100   630    0     0   5121      0 --:--:-- --:--:-- --:--:--  5121
8:42:23 PM: 100   832  100   832    0     0   5402      0 --:--:-- --:--:-- --:--:--  5402
8:42:23 PM: > Verifying integrity...
8:42:23 PM: gpg: Signature made Fri 02 Oct 2020 11:17:27 AM UTC
8:42:23 PM: gpg:                using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
8:42:23 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
8:42:23 PM: gpg: WARNING: This key is not certified with a trusted signature!
8:42:23 PM: gpg:          There is no indication that the signature belongs to the owner.
8:42:23 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
8:42:23 PM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
8:42:23 PM: > GPG signature looks good
8:42:23 PM: > Extracting to ~/.yarn...
8:42:23 PM: > Adding to $PATH...
8:42:24 PM: > Successfully installed Yarn 1.22.10! Please open another terminal where the `yarn` command will now be available.
8:42:24 PM: No yarn workspaces detected
8:42:24 PM: Started restoring cached node modules
8:42:24 PM: Finished restoring cached node modules
8:42:24 PM: Installing NPM modules using Yarn version 1.22.10
8:42:25 PM: yarn install v1.22.10
8:42:25 PM: [1/4] Resolving packages...
8:42:25 PM: [2/4] Fetching packages...
8:42:48 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
8:42:48 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
8:42:48 PM: info @next/swc-darwin-arm64@11.1.2: The platform "linux" is incompatible with this module.
8:42:48 PM: info "@next/swc-darwin-arm64@11.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
8:42:48 PM: info @next/swc-darwin-arm64@11.1.2: The CPU architecture "x64" is incompatible with this module.
8:42:48 PM: info @next/swc-darwin-x64@11.1.2: The platform "linux" is incompatible with this module.
8:42:48 PM: info "@next/swc-darwin-x64@11.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
8:42:48 PM: info @next/swc-win32-x64-msvc@11.1.2: The platform "linux" is incompatible with this module.
8:42:48 PM: info "@next/swc-win32-x64-msvc@11.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
8:42:48 PM: [3/4] Linking dependencies...
8:42:48 PM: warning "next > styled-jsx > @babel/plugin-syntax-jsx@7.14.5" has unmet peer dependency "@babel/core@^7.0.0-0".
8:42:48 PM: warning " > react-phone-input-international@2.15.6" has incorrect peer dependency "react@^16.12.0".
8:42:48 PM: warning " > react-phone-input-international@2.15.6" has incorrect peer dependency "react-dom@^16.12.0".
8:42:48 PM: warning Workspaces can only be enabled in private projects.
8:42:48 PM: warning Workspaces can only be enabled in private projects.
8:42:58 PM: [4/4] Building fresh packages...
8:43:01 PM: Done in 36.66s.
8:43:02 PM: NPM modules installed using Yarn
8:43:02 PM: Started restoring cached go cache
8:43:02 PM: Finished restoring cached go cache
8:43:02 PM: go version go1.16.5 linux/amd64
8:43:02 PM: go version go1.16.5 linux/amd64
8:43:02 PM: Installing missing commands
8:43:02 PM: Verify run directory
8:43:03 PM: ​
8:43:03 PM: ────────────────────────────────────────────────────────────────
8:43:03 PM:   Netlify Build                                                 
8:43:03 PM: ────────────────────────────────────────────────────────────────
8:43:03 PM: ​
8:43:03 PM: ❯ Version
8:43:03 PM:   @netlify/build 18.19.2
8:43:03 PM: ​
8:43:03 PM: ❯ Flags
8:43:03 PM:   baseRelDir: true
8:43:03 PM:   buildId: 617c0f4c6961c5197372c0e3
8:43:03 PM:   deployId: 617c0f4c6961c5197372c0e5
8:43:03 PM: ​
8:43:03 PM: ❯ Current directory
8:43:03 PM:   /opt/build/repo
8:43:03 PM: ​
8:43:03 PM: ❯ Config file
8:43:03 PM:   No config file was defined: using default values.
8:43:03 PM: ​
8:43:03 PM: ❯ Context
8:43:03 PM:   production
8:43:04 PM: ​
8:43:04 PM: ❯ Loading plugins
8:43:04 PM:    - @netlify/plugin-nextjs@3.9.2 from Netlify app and package.json
8:43:04 PM: ​
8:43:04 PM: ────────────────────────────────────────────────────────────────
8:43:04 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
8:43:04 PM: ────────────────────────────────────────────────────────────────
8:43:04 PM: ​
8:43:04 PM: Using Next.js 11.1.2
8:43:04 PM: Warning: support for Next.js >=11.1.0 is experimental
8:43:04 PM: info  - Loaded env from /opt/build/repo/.env
8:43:05 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
8:43:05 PM: The "target" config property must be one of "serverless", "experimental-serverless-trace". Building with "serverless" target.
8:43:05 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
8:43:05 PM: No Next.js cache to restore.
8:43:05 PM: ​
8:43:05 PM: (@netlify/plugin-nextjs onPreBuild completed in 1.1s)
8:43:05 PM: ​
8:43:05 PM: ────────────────────────────────────────────────────────────────
8:43:05 PM:   2. Build command from Netlify app                             
8:43:05 PM: ────────────────────────────────────────────────────────────────
8:43:05 PM: ​
8:43:05 PM: $ CI= npm run build
8:43:06 PM: > learn-starter@0.1.0 build
8:43:06 PM: > next build
8:43:07 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
8:43:07 PM: info  - Checking validity of types...
8:43:07 PM: warn  - No ESLint configuration detected. Run next lint to begin setup
8:43:07 PM: info  - Creating an optimized production build...
8:43:16 PM: warn - You have enabled the JIT engine which is currently in preview.
8:43:16 PM: warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
8:43:45 PM: (node:1768) [DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE] DeprecationWarning: Chunk.hasEntryModule: Use new ChunkGraph API
8:43:45 PM: (Use `node --trace-deprecation ...` to show where the warning was created)
8:43:47 PM: warn  - Compiled with warnings
8:43:47 PM: ./node_modules/next/dist/server/load-components.js
8:43:47 PM: Critical dependency: the request of a dependency is an expression
8:43:47 PM: ./node_modules/next/dist/server/load-components.js
8:43:47 PM: Critical dependency: the request of a dependency is an expression
8:43:47 PM: ./node_modules/next/dist/server/load-components.js
8:43:47 PM: Critical dependency: the request of a dependency is an expression
8:43:47 PM: ./node_modules/next/dist/server/require.js
8:43:47 PM: Critical dependency: the request of a dependency is an expression
8:43:47 PM: ./node_modules/next/dist/server/require.js
8:43:47 PM: Critical dependency: the request of a dependency is an expression
8:43:47 PM: ./node_modules/next/dist/server/require.js
8:43:47 PM: Critical dependency: the request of a dependency is an expression
8:43:47 PM: info  - Collecting page data...
8:43:47 PM: node:internal/process/promises:227
8:43:47 PM:         triggerUncaughtException(err, true /* fromPromise */);
8:43:47 PM:         ^
8:43:47 PM: /opt/build/repo/.next/serverless/chunks/48.js:2867
8:43:47 PM: module.exports=function(n,r){"use strict";var e={};function __nested_webpack_require_51__(r){if(e[r]){return e[r].exports}var t=e[r]={i:r,l:false,exports:{}};n[r].call(t.exports,t,t.exports,__nested_webpack_require_51__);t.l=true;return t.exports}__nested_webpack_require_51__.ab=__dirname+"/";function startup(){return __nested_webpack_require_51__(903)}r(__nested_webpack_require_51__);return startup()}({148:function(n){"use strict";var r=function(n){var r=n.ignoreProcessEnv?{}:process.env;var e=function(t){var o=t.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g)||[];return o.reduce(function(t,o){var c=/(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(o);var s=c[1];var i,f;if(s==="\\"){f=c[0];i=f.replace("\\$","$")}else{var p=c[2];f=c[0].substring(s.length);i=r.hasOwnProperty(p)?r[p]:n.parsed[p]||"";i=e(i)}return t.replace(f,i)},t)};for(var t in n.parsed){var o=r.hasOwnProperty(t)?r[t]:n.parsed[t];n.parsed[t]=e(o)}for(var c in n.parsed){r[c]=n.parsed[c]}return n};n.exports=r},548:function(n,r,e){const t=e(747);const o=e(622);function log(n){console.log(`[dotenv][DEBUG] ${n}`)}const c="\n";const s=/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;const i=/\\n/g;const f=/\n|\r|\r\n/;function parse(n,r){const e=Boolean(r&&r.debug);const t={};n.toString().split(f).forEach(function(n,r){const o=n.match(s);if(o!=null){const n=o[1];let r=o[2]||"";const e=r.length-1;const s=r[0]==='"'&&r[e]==='"';const f=r[0]==="'"&&r[e]==="'";if(f||s){r=r.substring(1,e);if(s){r=r.replace(i,c)}}else{r=r.trim()}t[n]=r}else if(e){log(`did not match key and value when parsing line ${r+1}: ${n}`)}});return t}function config(n){let r=o.resolve(process.cwd(),".env");let e="utf8";let c=false;if(n){if(n.path!=null){r=n.path}if(n.encoding!=null){e=n.encoding}if(n.debug!=null){c=true}}try{const n=parse(t.readFileSync(r,{encoding:e}),{debug:c});Object.keys(n).forEach(function(r){if(!Object.prototype.hasOwnProperty.call(process.env,r)){process.env[r]=n[r]}else if(c){log(`"${r}" is already defined in \`process.env\` and will not be overwritten`)}});return{parsed:n}}catch(n){return{error:n}}}n.exports.config=config;n.exports.parse=parse},622:function(n){n.exports=__webpack_require__(85622)},747:function(n){n.exports=__webpack_require__(35747)},903:function(n,r,e){"use strict";e.r(r);e.d(r,"processEnv",function(){return processEnv});e.d(r,"loadEnvConfig",function(){return loadEnvConfig});var t=e(747);var o=e.n(t);var c=e(622);var s=e.n(c);var i=e(548);var f=e.n(i);var p=e(148);var u=e.n(p);let a=undefined;let d=[];function processEnv(n,r,e=console){var t;if(true){return process.env}"true"="true";const o=Object.assign({},process.env);const s={};for(const f of n){try{let n={};n.parsed=i.parse(f.contents);n=u()(n);if(n.parsed){e.info(`Loaded env from ${c.join(r||"",f.path)}`)}for(const r of Object.keys(n.parsed||{})){if(typeof s[r]==="undefined"&&typeof o[r]==="undefined"){s[r]=(t=n.parsed)===null||t===void 0?void 0:t[r]}}}catch(n){e.error(`Failed to load env from ${c.join(r||"",f.path)}`,n)}}return Object.assign(process.env,s)}function loadEnvConfig(n,r,e=console){if(a)return{combinedEnv:a,loadedEnvFiles:d};const o="production"==="test";const s=o?"test":r?"development":"production";const i=[`.env.${s}.local`,s!=="test"&&`.env.local`,`.env.${s}`,".env"].filter(Boolean);for(const r of i){const o=c.join(n,r);try{const n=t.statSync(o);if(!n.isFile()){continue}const c=t.readFileSync(o,"utf8");d.push({path:r,contents:c})}catch(n){if(n.code!=="ENOENT"){e.error(`Failed to load env from ${r}`,n)}}}a=processEnv(d,n,e);return{combinedEnv:a,loadedEnvFiles:d}}}},function(n){"use strict";!function(){n.r=function(n){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(n,"__esModule",{value:true})}}();!function(){n.n=function(r){var e=r&&r.__esModule?function getDefault(){return r["default"]}:function getModuleExports(){return r};n.d(e,"a",e);return e}}();!function(){var r=Object.prototype.hasOwnProperty;n.d=function(n,e,t){if(!r.call(n,e)){Object.defineProperty(n,e,{enumerable:true,get:t})}}}()});
8:43:47 PM: SyntaxError: Invalid left-hand side in assignment
8:43:47 PM:     at Object.compileFunction (node:vm:352:18)
8:43:47 PM:     at wrapSafe (node:internal/modules/cjs/loader:1031:15)
8:43:47 PM:     at Module._compile (node:internal/modules/cjs/loader:1065:27)
8:43:47 PM:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
8:43:47 PM:     at Module.load (node:internal/modules/cjs/loader:981:32)
8:43:47 PM:     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
8:43:47 PM:     at Module.require (node:internal/modules/cjs/loader:1005:19)
8:43:47 PM:     at require (node:internal/modules/cjs/helpers:102:18)
8:43:47 PM:     at Object.__webpack_require__.f.require (/opt/build/repo/.next/serverless/pages/_error.js:436:28)
8:43:47 PM:     at /opt/build/repo/.next/serverless/pages/_error.js:359:40 {
8:43:47 PM:   type: 'SyntaxError'
8:43:47 PM: }
8:43:47 PM: ​
8:43:47 PM: ────────────────────────────────────────────────────────────────
8:43:47 PM:   "build.command" failed                                        
8:43:47 PM: ────────────────────────────────────────────────────────────────
8:43:47 PM: ​
8:43:47 PM:   Error message
8:43:47 PM:   Command failed with exit code 1: CI= npm run build
8:43:47 PM: ​
8:43:47 PM:   Error location
8:43:47 PM:   In Build command from Netlify app:
8:43:47 PM:   CI= npm run build
8:43:47 PM: ​
8:43:47 PM:   Resolved config
8:43:47 PM:   build:
8:43:47 PM:     command: CI= npm run build
8:43:47 PM:     commandOrigin: ui
8:43:47 PM:     environment:
8:43:47 PM:       - REACT_APP_APIURL
8:43:47 PM:     publish: /opt/build/repo/out
8:43:47 PM:     publishOrigin: ui
8:43:47 PM:   plugins:
8:43:47 PM:     - inputs: {}
8:43:47 PM:       origin: ui
8:43:47 PM:       package: '@netlify/plugin-nextjs'
8:43:48 PM: Caching artifacts
8:43:48 PM: Started saving node modules
8:43:48 PM: Finished saving node modules
8:43:48 PM: Started saving build plugins
8:43:48 PM: Finished saving build plugins
8:43:48 PM: Started saving yarn cache
8:43:54 PM: Finished saving yarn cache
8:43:54 PM: Started saving pip cache
8:43:54 PM: Finished saving pip cache
8:43:54 PM: Started saving emacs cask dependencies
8:43:54 PM: Finished saving emacs cask dependencies
8:43:54 PM: Started saving maven dependencies
8:43:54 PM: Finished saving maven dependencies
8:43:54 PM: Started saving boot dependencies
8:43:54 PM: Finished saving boot dependencies
8:43:54 PM: Started saving rust rustup cache
8:43:54 PM: Finished saving rust rustup cache
8:43:54 PM: Started saving go dependencies
8:43:54 PM: Finished saving go dependencies
8:43:57 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:43:57 PM: Creating deploy upload records
8:43:57 PM: Failing build: Failed to build site
8:43:57 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
8:43:57 PM: Finished processing build request in 1m43.471028842s

Hey there, @kuldeep178 :wave:

Thanks so much for reaching out. Can you please link us to your site and your public repo? Additionally, have you attempted this with the beta version of our plugin as well? You can see our beta conversations happening on this repo.