Home
Support Forums

Can't build NextJS TypeScript project integrated with Sentry

I need advice to debug deploy Netlify App

The started after Sentry was integrated with the project. I don’t know where this @zeit dependency came from. I followed the Sentry-NextJS integration step-by-step but Netlify is throwing this error.

The catch is that I’m able to build this project on my local machine, but on Netlify it’s failing.

Here’s the error log:

4:33:51 PM: Build ready to start
4:33:53 PM: build-image version: 653805ca4a64301556e56dc4b321ef8fc20cbb7c
4:33:53 PM: build-image tag: v3.8.2
4:33:53 PM: buildbot version: 0a59d4f6f84f78a782fdb08c5d1b2f7aaaf0cab8
4:33:53 PM: Fetching cached dependencies
4:33:53 PM: Starting to download cache of 229.4MB
4:33:54 PM: Finished downloading cache in 1.202197006s
4:33:54 PM: Starting to extract cache
4:34:03 PM: Finished extracting cache in 8.911007304s
4:34:03 PM: Finished fetching cache in 10.175782168s
4:34:03 PM: Starting to prepare the repo for build
4:34:04 PM: Preparing Git Reference merge-requests/5/head
4:34:05 PM: Parsing package.json dependencies
4:34:06 PM: Starting build script
4:34:06 PM: Installing dependencies
4:34:06 PM: Python version set to 2.7
4:34:07 PM: Started restoring cached node version
4:34:09 PM: Finished restoring cached node version
4:34:10 PM: v12.18.0 is already installed.
4:34:11 PM: Now using node v12.18.0 (npm v6.14.4)
4:34:11 PM: Started restoring cached build plugins
4:34:11 PM: Finished restoring cached build plugins
4:34:11 PM: Attempting ruby version 2.7.2, read from environment
4:34:13 PM: Using ruby version 2.7.2
4:34:13 PM: Using PHP version 5.6
4:34:13 PM: Started restoring cached yarn cache
4:34:17 PM: Finished restoring cached yarn cache
4:34:17 PM: No yarn workspaces detected
4:34:17 PM: Started restoring cached node modules
4:34:17 PM: Finished restoring cached node modules
4:34:18 PM: Installing NPM modules using Yarn version 1.22.10
4:34:18 PM: yarn install v1.22.10
4:34:18 PM: [1/4] Resolving packages...
4:34:19 PM: [2/4] Fetching packages...
4:34:21 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
4:34:21 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
4:34:21 PM: [3/4] Linking dependencies...
4:34:21 PM: warning "analytics > @analytics/core > analytics-utils@0.4.8" has unmet peer dependency "@types/dlv@^1.0.0".
4:34:21 PM: warning " > eslint-config-airbnb@18.2.1" has unmet peer dependency "eslint-plugin-react-hooks@^4 || ^3 || ^2.3.0 || ^1.7.0".
4:34:25 PM: [4/4] Building fresh packages...
4:34:25 PM: Done in 7.35s.
4:34:25 PM: NPM modules installed using Yarn
4:34:26 PM: Started restoring cached go cache
4:34:26 PM: Finished restoring cached go cache
4:34:26 PM: go version go1.14.4 linux/amd64
4:34:26 PM: go version go1.14.4 linux/amd64
4:34:26 PM: Installing missing commands
4:34:26 PM: Verify run directory
4:34:26 PM: ​
4:34:26 PM: ────────────────────────────────────────────────────────────────
4:34:26 PM:   Netlify Build                                                 
4:34:26 PM: ────────────────────────────────────────────────────────────────
4:34:26 PM: ​
4:34:26 PM: ❯ Version
4:34:26 PM:   @netlify/build 17.8.0
4:34:26 PM: ​
4:34:26 PM: ❯ Flags
4:34:26 PM:   deployId: 610a74165bde170007bdf183
4:34:26 PM: ​
4:34:26 PM: ❯ Current directory
4:34:26 PM:   /opt/build/repo
4:34:26 PM: ​
4:34:26 PM: ❯ Config file
4:34:26 PM:   No config file was defined: using default values.
4:34:26 PM: ​
4:34:26 PM: ❯ Context
4:34:26 PM:   deploy-preview
4:34:27 PM: ​
4:34:27 PM: ❯ Installing plugins
4:34:27 PM:    - @sentry/netlify-build-plugin@1.1.0
4:34:32 PM: ​
4:34:32 PM: ❯ Loading plugins
4:34:32 PM:    - @netlify/plugin-nextjs@3.8.0 from Netlify app
4:34:32 PM:    - @sentry/netlify-build-plugin@1.1.0 from Netlify app
4:34:32 PM: ​
4:34:32 PM: ────────────────────────────────────────────────────────────────
4:34:32 PM:   1. onPreBuild command from @netlify/plugin-nextjs             
4:34:32 PM: ────────────────────────────────────────────────────────────────
4:34:32 PM: ​
4:34:32 PM: Using Next.js 11.0.1
4:34:33 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
4:34:33 PM: The "target" config property must be one of "serverless", "experimental-serverless-trace". Building with "serverless" target.
4:34:34 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
4:34:34 PM: Next.js cache restored.
4:34:34 PM: ​
4:34:34 PM: (@netlify/plugin-nextjs onPreBuild completed in 1.6s)
4:34:34 PM: ​
4:34:34 PM: ────────────────────────────────────────────────────────────────
4:34:34 PM:   2. Build command from Netlify app                             
4:34:34 PM: ────────────────────────────────────────────────────────────────
4:34:34 PM: ​
4:34:34 PM: $ yarn build
4:34:34 PM: yarn run v1.22.10
4:34:34 PM: $ next build
4:34:35 PM: info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
4:34:36 PM: info  - Checking validity of types...
4:34:49 PM: ./pages/property.tsx
4:34:49 PM: 27:10  Warning: 'Gallery' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: 48:10  Warning: 'InvestmentHighlights' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: 74:10  Warning: 'LocationHighlights' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: 83:10  Warning: 'ActionBox' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: 86:13  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
4:34:49 PM: 205:10  Warning: 'Overview' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: 250:10  Warning: 'Reports' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: 262:13  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
4:34:49 PM: 264:40  Warning: 'property' is defined but never used.  @typescript-eslint/no-unused-vars
4:34:49 PM: Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
4:34:49 PM: info  - Creating an optimized production build...
4:34:56 PM: warn - You have enabled the JIT engine which is currently in preview.
4:34:56 PM: warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
4:35:32 PM: Failed to compile.
4:35:32 PM: 
4:35:32 PM: ModuleNotFoundError: Module not found: Error: Can't resolve '@zeit/next-sass' in '/opt/build/repo/node_modules/next/dist/build'
4:35:32 PM: > Build error occurred
4:35:32 PM: Error: > Build failed because of webpack errors
4:35:32 PM:     at /opt/build/repo/node_modules/next/dist/build/index.js:15:924
4:35:32 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:6:584)
4:35:32 PM: error Command failed with exit code 1.
4:35:32 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
4:35:32 PM: ​
4:35:32 PM: ────────────────────────────────────────────────────────────────
4:35:32 PM:   "build.command" failed                                        
4:35:32 PM: ────────────────────────────────────────────────────────────────
4:35:32 PM: ​
4:35:32 PM:   Error message
4:35:32 PM:   Command failed with exit code 1: yarn build
4:35:32 PM: ​
4:35:32 PM:   Error location
4:35:32 PM:   In Build command from Netlify app:
4:35:32 PM:   yarn build
4:35:32 PM: ​
4:35:32 PM:   Resolved config
4:35:32 PM:   build:
4:35:32 PM:     command: yarn build
4:35:32 PM:     commandOrigin: ui
4:35:32 PM:     environment:
4:35:32 PM:       - NEXT_PUBLIC_BASE_URL
4:35:32 PM:       - NEXT_PUBLIC_SENTRY_DSN
4:35:32 PM:       - REVIEW_ID
4:35:32 PM:       - SENTRY_AUTH_TOKEN
4:35:32 PM:       - SENTRY_DSN
4:35:32 PM:       - SENTRY_ORG
4:35:32 PM:       - SENTRY_PROJECT
4:35:32 PM:       - SENTRY_URL
4:35:32 PM:     publish: /opt/build/repo/build
4:35:32 PM:     publishOrigin: ui
4:35:32 PM:   plugins:
4:35:32 PM:     - inputs: {}
4:35:32 PM:       origin: ui
4:35:32 PM:       package: '@netlify/plugin-nextjs'
4:35:32 PM:     - inputs: {}
4:35:32 PM:       origin: ui
4:35:32 PM:       package: '@sentry/netlify-build-plugin'
4:35:33 PM: Caching artifacts
4:35:33 PM: Started saving node modules
4:35:33 PM: Finished saving node modules
4:35:33 PM: Started saving build plugins
4:35:33 PM: Finished saving build plugins
4:35:33 PM: Started saving yarn cache
4:35:37 PM: Finished saving yarn cache
4:35:37 PM: Started saving pip cache
4:35:37 PM: Finished saving pip cache
4:35:37 PM: Started saving emacs cask dependencies
4:35:37 PM: Finished saving emacs cask dependencies
4:35:37 PM: Started saving maven dependencies
4:35:37 PM: Finished saving maven dependencies
4:35:37 PM: Started saving boot dependencies
4:35:37 PM: Finished saving boot dependencies
4:35:37 PM: Started saving rust rustup cache
4:35:37 PM: Finished saving rust rustup cache
4:35:37 PM: Started saving go dependencies
4:35:37 PM: Finished saving go dependencies
4:35:37 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:35:37 PM: Creating deploy upload records
4:35:37 PM: Failing build: Failed to build site
4:35:37 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
4:35:37 PM: Finished processing build request in 1m44.349991443s

Hi there, @shabdsaran :wave:

Thanks so much for reaching out. Would you mind sharing your github repo for this, as well as any debugging steps you have already attempted? Is this occurring in multiple browsers / machines?

Let us know :slight_smile: