Home
Support Forums

Deployment issues due to the defined netlify.toml file not being read during a build

Hi,

I’m experiencing issues deploying a Sanity starter to Netlify. The starter builds two subdirectories: web (frontend with Nextjs) and studio (sanity studio dashboard), which should be deployed separately. I’m using the Netlify nextjs plugin and tested the starter by deploying the starter repository directly to Netlify from this fork (even though I had to move all “devDependencies” to “dependencies” for it to build successfully). You can preview the test here: https://sanity-commercelayer-web-4fb273.netlify.app and https://sanity-commercelayer-studio-9430d6.netlify.app.

However, when I try to deploy the starter from Sanity (which creates a new repository, adds sanity project ID and dataset to the project, automatically deploys the web and studio directories to Netlify using the configuration and environment variables from netlify.toml), the build fails because Netlify doesn’t use the configuration file and hence builds without it.

9:24:00 AM: ❯ Config file
9:24:00 AM:   No config file was defined: using default values.

I want to be able to build both directories using the netlify.toml configuration file I have specified.

  • For web: fetch config and env from netlify.toml and build.
  • For studio: fetch config and redirect rule from netlify.toml and build.

Below is the build log for both deployments when sanity deploys the starter (web builds with errors from missing variables and studio builds successfully without the redirect rule):

Web

1:33:18 PM: Waiting for other deploys from your team to complete
1:36:04 PM: Build ready to start
1:36:06 PM: build-image version: 3571f0130496395a23bffe9820bc78b4f73a6234
1:36:06 PM: build-image tag: v3.7.0
1:36:06 PM: buildbot version: 1d9a65d1462a996a4489967112d0532ab577cee9
1:36:06 PM: Fetching cached dependencies
1:36:06 PM: Failed to fetch cache, continuing with build
1:36:06 PM: Starting to prepare the repo for build
1:36:07 PM: No cached dependencies found. Cloning fresh repo
1:36:07 PM: git clone git@github.com:BolajiAyodeji/test-sanity-commercelayer
1:36:08 PM: Preparing Git Reference refs/heads/main
1:36:10 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
1:36:10 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'web/out' versus '/web/out' in the Netlify UI
1:36:10 PM: Starting build script
1:36:10 PM: Installing dependencies
1:36:10 PM: Python version set to 2.7
1:36:11 PM: v12.18.0 is already installed.
1:36:12 PM: Now using node v12.18.0 (npm v6.14.4)
1:36:12 PM: Started restoring cached build plugins
1:36:12 PM: Finished restoring cached build plugins
1:36:12 PM: Attempting ruby version 2.7.1, read from environment
1:36:13 PM: Using ruby version 2.7.1
1:36:14 PM: Using PHP version 5.6
1:36:14 PM: Started restoring cached node modules
1:36:14 PM: Finished restoring cached node modules
1:36:14 PM: Installing NPM modules using NPM version 6.14.4
1:36:26 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
1:36:26 PM: > sanity-template-commercelayer@ postinstall /opt/build/repo
1:36:26 PM: > lerna bootstrap
1:36:26 PM: lerna notice cli v4.0.0
1:36:26 PM: lerna info ci enabled
1:36:27 PM: lerna info Bootstrapping 2 packages
1:36:27 PM: lerna info Installing external dependencies
1:37:02 PM: lerna info Symlinking packages and binaries
1:37:02 PM: lerna success Bootstrapped 2 packages
1:37:02 PM: npm WARN sanity-template-commercelayer@ No description
1:37:02 PM: npm WARN sanity-template-commercelayer@ No repository field.
1:37:02 PM: npm WARN sanity-template-commercelayer@ No license field.
1:37:02 PM: added 633 packages from 316 contributors and audited 633 packages in 47.432s
1:37:03 PM: 62 packages are looking for funding
1:37:03 PM:   run `npm fund` for details
1:37:03 PM: found 0 vulnerabilities
1:37:03 PM: NPM modules installed
1:37:03 PM: Started restoring cached go cache
1:37:03 PM: Finished restoring cached go cache
1:37:03 PM: go version go1.14.4 linux/amd64
1:37:03 PM: go version go1.14.4 linux/amd64
1:37:03 PM: Installing missing commands
1:37:03 PM: Verify run directory
1:37:05 PM: ​
1:37:05 PM: ────────────────────────────────────────────────────────────────
1:37:05 PM:   Netlify Build                                                 
1:37:05 PM: ────────────────────────────────────────────────────────────────
1:37:05 PM: ​
1:37:05 PM: ❯ Version
1:37:05 PM:   @netlify/build 9.9.7
1:37:05 PM: ​
1:37:05 PM: ❯ Flags
1:37:05 PM:   apiHost: api.netlify.com
1:37:05 PM:   cacheDir: /opt/build/cache
1:37:05 PM:   deployId: 6050a58e33eed3b3c1769cf8
1:37:05 PM:   mode: buildbot
1:37:05 PM:   testOpts:
1:37:05 PM:     silentLingeringProcesses: ''
1:37:05 PM: ​
1:37:05 PM: ❯ Current directory
1:37:05 PM:   /opt/build/repo
1:37:05 PM: ​
1:37:05 PM: ❯ Config file
1:37:05 PM:   No config file was defined: using default values.
1:37:05 PM: ​
1:37:05 PM: ❯ Context
1:37:05 PM:   production
1:37:05 PM: ​
1:37:05 PM: ────────────────────────────────────────────────────────────────
1:37:05 PM:   1. Build command from Netlify app                             
1:37:05 PM: ────────────────────────────────────────────────────────────────
1:37:05 PM: ​
1:37:05 PM: $ npm run build-web
1:37:05 PM: > sanity-template-commercelayer@ build-web /opt/build/repo
1:37:05 PM: > lerna bootstrap && (cd web && npm run build)
1:37:05 PM: lerna notice cli v4.0.0
1:37:05 PM: lerna info ci enabled
1:37:06 PM: lerna info Bootstrapping 2 packages
1:37:06 PM: lerna info Installing external dependencies
1:37:24 PM: lerna info Symlinking packages and binaries
1:37:24 PM: lerna success Bootstrapped 2 packages
1:37:24 PM: > sanity-template-commercelayer-web@1.0.0 build /opt/build/repo/web
1:37:24 PM: > next build
1:37:26 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
1:37:26 PM: info  - Creating an optimized production build...
1:37:37 PM: warn - Tailwind is not purging unused styles because no template paths have been provided.
1:37:37 PM: warn - If you have manually configured PurgeCSS outside of Tailwind or are deliberately not removing unused styles, set `purge: false` in your Tailwind config file to silence this warning.
1:37:37 PM: warn - https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
1:38:33 PM: warn  - Compiled with warnings
1:38:33 PM: ./node_modules/next/dist/next-server/server/load-components.js
1:38:33 PM: Critical dependency: the request of a dependency is an expression
1:38:33 PM: ./node_modules/next/dist/next-server/server/load-components.js
1:38:33 PM: Critical dependency: the request of a dependency is an expression
1:38:33 PM: ./node_modules/next/dist/next-server/server/require.js
1:38:33 PM: Critical dependency: the request of a dependency is an expression
1:38:33 PM: ./node_modules/next/dist/next-server/server/require.js
1:38:33 PM: Critical dependency: the request of a dependency is an expression
1:38:33 PM: ./node_modules/next/dist/next-server/server/require.js
1:38:33 PM: Critical dependency: the request of a dependency is an expression
1:38:33 PM: info  - Collecting page data...
1:38:34 PM: info  - Generating static pages (0/5)
1:38:35 PM: info  - Generating static pages (1/5)
1:38:35 PM: info  - Generating static pages (2/5)
1:38:35 PM: Unhandled error during request: SerializableError: Error serializing `.cms` returned from `getStaticProps` in "/".
1:38:35 PM: Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.
1:38:35 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:95)
1:38:35 PM:     at /opt/build/repo/web/.next/serverless/pages/index.js:18838:490
1:38:35 PM:     at Array.every (<anonymous>)
1:38:35 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:291)
1:38:35 PM:     at isSerializableProps (/opt/build/repo/web/.next/serverless/pages/index.js:18840:219)
1:38:35 PM:     at renderToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:1189:1368)
1:38:35 PM:     at async renderReqToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:8463:334)
1:38:35 PM:     at async /opt/build/repo/web/node_modules/next/dist/export/worker.js:12:92
1:38:35 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
1:38:35 PM: info  - Generating static pages (3/5)
1:38:35 PM: Error occurred prerendering page "/". Read more: https://err.sh/next.js/prerender-error
1:38:35 PM: Error: Error serializing `.cms` returned from `getStaticProps` in "/".
1:38:35 PM: Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.
1:38:35 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:95)
1:38:35 PM:     at /opt/build/repo/web/.next/serverless/pages/index.js:18838:490
1:38:35 PM:     at Array.every (<anonymous>)
1:38:35 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:291)
1:38:35 PM:     at isSerializableProps (/opt/build/repo/web/.next/serverless/pages/index.js:18840:219)
1:38:35 PM:     at renderToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:1189:1368)
1:38:35 PM:     at async renderReqToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:8463:334)
1:38:35 PM:     at async /opt/build/repo/web/node_modules/next/dist/export/worker.js:12:92
1:38:35 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
1:38:35 PM: info  - Generating static pages (5/5)
1:38:35 PM: > Build error occurred
1:38:35 PM: Error: Export encountered errors on following paths:
1:38:35 PM: 	/
1:38:35 PM:     at /opt/build/repo/web/node_modules/next/dist/export/index.js:31:1103
1:38:35 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
1:38:35 PM:     at async /opt/build/repo/web/node_modules/next/dist/build/index.js:41:49
1:38:35 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
1:38:35 PM:     at async /opt/build/repo/web/node_modules/next/dist/build/index.js:23:1472
1:38:35 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
1:38:35 PM: npm ERR! code ELIFECYCLE
1:38:35 PM: npm ERR! errno 1
1:38:35 PM: npm ERR! sanity-template-commercelayer-web@1.0.0 build: `next build`
1:38:35 PM: npm ERR! Exit status 1
1:38:35 PM: npm ERR!
1:38:35 PM: npm ERR! Failed at the sanity-template-commercelayer-web@1.0.0 build script.
1:38:35 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:38:36 PM: npm ERR! A complete log of this run can be found in:
1:38:36 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-03-16T12_38_36_000Z-debug.log
1:38:36 PM: npm ERR! code ELIFECYCLE
1:38:36 PM: npm ERR! errno 1
1:38:36 PM: npm ERR! sanity-template-commercelayer@ build-web: `lerna bootstrap && (cd web && npm run build)`
1:38:36 PM: npm ERR! Exit status 1
1:38:36 PM: npm ERR!
1:38:36 PM: npm ERR! Failed at the sanity-template-commercelayer@ build-web script.
1:38:36 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:38:36 PM: npm ERR! A complete log of this run can be found in:
1:38:36 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-03-16T12_38_36_015Z-debug.log
1:38:36 PM: ​
1:38:36 PM: ────────────────────────────────────────────────────────────────
1:38:36 PM:   "build.command" failed                                        
1:38:36 PM: ────────────────────────────────────────────────────────────────
1:38:36 PM: ​
1:38:36 PM:   Error message
1:38:36 PM:   Command failed with exit code 1: npm run build-web
1:38:36 PM: ​
1:38:36 PM:   Error location
1:38:36 PM:   In Build command from Netlify app:
1:38:36 PM:   npm run build-web
1:38:36 PM: ​
1:38:36 PM:   Resolved config
1:38:36 PM:   build:
1:38:36 PM:     base: /opt/build/repo
1:38:36 PM:     command: npm run build-web
1:38:36 PM:     commandOrigin: ui
1:38:36 PM:     publish: /opt/build/repo/web/out
1:38:36 PM: Caching artifacts
1:38:36 PM: Started saving node modules
1:38:36 PM: Finished saving node modules
1:38:36 PM: Started saving build plugins
1:38:36 PM: Finished saving build plugins
1:38:36 PM: Started saving pip cache
1:38:36 PM: Finished saving pip cache
1:38:36 PM: Started saving emacs cask dependencies
1:38:36 PM: Finished saving emacs cask dependencies
1:38:36 PM: Started saving maven dependencies
1:38:36 PM: Finished saving maven dependencies
1:38:36 PM: Started saving boot dependencies
1:38:36 PM: Finished saving boot dependencies
1:38:36 PM: Started saving rust rustup cache
1:38:36 PM: Finished saving rust rustup cache
1:38:36 PM: Started saving go dependencies
1:38:36 PM: Finished saving go dependencies
1:38:38 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:38:38 PM: Failing build: Failed to build site
1:38:39 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
1:38:39 PM: Finished processing build request in 2m32.53184698s

Studio

1:33:18 PM: Build ready to start
1:33:19 PM: build-image version: 3571f0130496395a23bffe9820bc78b4f73a6234
1:33:19 PM: build-image tag: v3.7.0
1:33:19 PM: buildbot version: 1d9a65d1462a996a4489967112d0532ab577cee9
1:33:19 PM: Fetching cached dependencies
1:33:19 PM: Failed to fetch cache, continuing with build
1:33:19 PM: Starting to prepare the repo for build
1:33:20 PM: No cached dependencies found. Cloning fresh repo
1:33:20 PM: git clone git@github.com:BolajiAyodeji/test-sanity-commercelayer
1:33:21 PM: Preparing Git Reference refs/heads/main
1:33:23 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
1:33:23 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'studio/dist' versus '/studio/dist' in the Netlify UI
1:33:23 PM: Starting build script
1:33:23 PM: Installing dependencies
1:33:23 PM: Python version set to 2.7
1:33:24 PM: v12.18.0 is already installed.
1:33:25 PM: Now using node v12.18.0 (npm v6.14.4)
1:33:25 PM: Started restoring cached build plugins
1:33:25 PM: Finished restoring cached build plugins
1:33:25 PM: Attempting ruby version 2.7.1, read from environment
1:33:26 PM: Using ruby version 2.7.1
1:33:27 PM: Using PHP version 5.6
1:33:27 PM: Started restoring cached node modules
1:33:27 PM: Finished restoring cached node modules
1:33:27 PM: Installing NPM modules using NPM version 6.14.4
1:33:39 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
1:33:39 PM: > sanity-template-commercelayer@ postinstall /opt/build/repo
1:33:39 PM: > lerna bootstrap
1:33:39 PM: lerna notice cli v4.0.0
1:33:39 PM: lerna info ci enabled
1:33:40 PM: lerna info Bootstrapping 2 packages
1:33:40 PM: lerna info Installing external dependencies
1:34:15 PM: lerna info Symlinking packages and binaries
1:34:15 PM: lerna success Bootstrapped 2 packages
1:34:16 PM: npm WARN sanity-template-commercelayer@ No description
1:34:16 PM: npm WARN sanity-template-commercelayer@ No repository field.
1:34:16 PM: npm WARN sanity-template-commercelayer@ No license field.
1:34:16 PM: added 633 packages from 316 contributors and audited 633 packages in 48.392s
1:34:17 PM: 62 packages are looking for funding
1:34:17 PM:   run `npm fund` for details
1:34:17 PM: found 0 vulnerabilities
1:34:17 PM: NPM modules installed
1:34:17 PM: Started restoring cached go cache
1:34:17 PM: Finished restoring cached go cache
1:34:17 PM: go version go1.14.4 linux/amd64
1:34:17 PM: go version go1.14.4 linux/amd64
1:34:17 PM: Installing missing commands
1:34:17 PM: Verify run directory
1:34:19 PM: ​
1:34:19 PM: ────────────────────────────────────────────────────────────────
1:34:19 PM:   Netlify Build                                                 
1:34:19 PM: ────────────────────────────────────────────────────────────────
1:34:19 PM: ​
1:34:19 PM: ❯ Version
1:34:19 PM:   @netlify/build 9.9.7
1:34:19 PM: ​
1:34:19 PM: ❯ Flags
1:34:19 PM:   apiHost: api.netlify.com
1:34:19 PM:   cacheDir: /opt/build/cache
1:34:19 PM:   deployId: 6050a58e802d5bd09fc9ffc7
1:34:19 PM:   mode: buildbot
1:34:19 PM:   testOpts:
1:34:19 PM:     silentLingeringProcesses: ''
1:34:19 PM: ​
1:34:19 PM: ❯ Current directory
1:34:19 PM:   /opt/build/repo
1:34:19 PM: ​
1:34:19 PM: ❯ Config file
1:34:19 PM:   No config file was defined: using default values.
1:34:19 PM: ​
1:34:19 PM: ❯ Context
1:34:19 PM:   production
1:34:19 PM: ​
1:34:19 PM: ────────────────────────────────────────────────────────────────
1:34:19 PM:   1. Build command from Netlify app                             
1:34:19 PM: ────────────────────────────────────────────────────────────────
1:34:19 PM: ​
1:34:19 PM: $ npm run build-studio
1:34:19 PM: > sanity-template-commercelayer@ build-studio /opt/build/repo
1:34:19 PM: > lerna bootstrap && (cd studio && npm run build)
1:34:19 PM: lerna notice cli v4.0.0
1:34:19 PM: lerna info ci enabled
1:34:20 PM: lerna info Bootstrapping 2 packages
1:34:20 PM: lerna info Installing external dependencies
1:34:38 PM: lerna info Symlinking packages and binaries
1:34:38 PM: lerna success Bootstrapped 2 packages
1:34:39 PM: > sanity-template-commercelayer-studio@1.0.0 build /opt/build/repo/studio
1:34:39 PM: > sanity build
1:36:02 PM: ​
1:36:02 PM: (build.command completed in 1m 43.7s)
1:36:02 PM: ​
1:36:02 PM: ────────────────────────────────────────────────────────────────
1:36:02 PM:   2. Deploy site                                                
1:36:02 PM: ────────────────────────────────────────────────────────────────
1:36:02 PM: ​
1:36:02 PM: Starting to deploy site from 'studio/dist'
1:36:02 PM: Creating deploy tree 
1:36:02 PM: Creating deploy upload records
1:36:03 PM: 2 new files to upload
1:36:03 PM: 0 new functions to upload
1:36:03 PM: Site deploy was successfully initiated
1:36:03 PM: ​
1:36:03 PM: (Deploy site completed in 652ms)
1:36:03 PM: ​
1:36:03 PM: ────────────────────────────────────────────────────────────────
1:36:03 PM:   Netlify Build Complete                                        
1:36:03 PM: ────────────────────────────────────────────────────────────────
1:36:03 PM: ​
1:36:03 PM: (Netlify Build completed in 1m 44.4s)
1:36:03 PM: Caching artifacts
1:36:03 PM: Starting post processing
1:36:03 PM: Started saving node modules
1:36:03 PM: Finished saving node modules
1:36:03 PM: Started saving build plugins
1:36:03 PM: Finished saving build plugins
1:36:03 PM: Started saving pip cache
1:36:03 PM: Post processing - HTML
1:36:03 PM: Finished saving pip cache
1:36:03 PM: Started saving emacs cask dependencies
1:36:03 PM: Finished saving emacs cask dependencies
1:36:03 PM: Started saving maven dependencies
1:36:03 PM: Finished saving maven dependencies
1:36:03 PM: Started saving boot dependencies
1:36:03 PM: Post processing - header rules
1:36:03 PM: Finished saving boot dependencies
1:36:03 PM: Started saving rust rustup cache
1:36:03 PM: Finished saving rust rustup cache
1:36:03 PM: Started saving go dependencies
1:36:03 PM: Finished saving go dependencies
1:36:03 PM: Post processing - redirect rules
1:36:03 PM: Post processing done
1:36:04 PM: Site is live ✨
1:36:06 PM: Build script success
1:36:23 PM: Finished processing build request in 3m4.115484141s

This is the created repository from Sanity: https://github.com/BolajiAyodeji/test-sanity-commercelayer.

Please let me know if you need any further clarifications or any more details. Everything works fine when I try to deploy with Vercel, but it looks like Netlify is different. I’ve tried several options to resolve, but I’m not sure what I’m doing wrong or the right approach to get this working.

I appreciate your time, thanks!

Hey there, @BolajiAyodeji :wave:

Thanks so much for reaching out about this. I am not sure if you saw, but a few hours after you posted this we made an announcement about the Essential Next.js Plugin! We also cleaned up a few bugs. Can you install the new plugin and then tell me if you are still experiencing this issue?

Thank you!

1 Like

Thanks for getting back to me. I’ll give this a trial and get back to you.

Cheers!

1 Like

Based on the new announcement, the new plugin doesn’t require any new installation if you have it setup already. But I don’t think my issue is related to the Nextjs plugin since the studio is not built with Nextjs and netlify.toml is not being read there too.

Anyways, I tried deploying again and I’m still experiencing the same issues. What can I do, please?

Hey there, @BolajiAyodeji

Thanks for following up! I appreciate it. I have looked at your repos, and it looks like your sites are not building from the web directory or the studio directory. Since your .toml files are inside the web directory and the studio directory, that is why it is not being read. Take a look at this support guide!

1 Like

Hi @hillary

Thanks for your response. I just followed the guide you shared and specified the base and publish directory to web, web/out and studio, studio/dist respectively. However, Netlify still fails to read the netlify.toml configuration file and returns the same issues. Here’s my build log:

6:07:58 PM: Build ready to start
6:08:00 PM: build-image version: 3571f0130496395a23bffe9820bc78b4f73a6234
6:08:00 PM: build-image tag: v3.7.0
6:08:00 PM: buildbot version: 35681551598b95548b996201c978361e7ed9f7e7
6:08:00 PM: Fetching cached dependencies
6:08:00 PM: Failed to fetch cache, continuing with build
6:08:00 PM: Starting to prepare the repo for build
6:08:01 PM: No cached dependencies found. Cloning fresh repo
6:08:01 PM: git clone git@github.com:BolajiAyodeji/new-sanity-commercelayer
6:08:03 PM: Preparing Git Reference refs/heads/main
6:08:06 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
6:08:06 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'web/out' versus '/web/out' in the Netlify UI
6:08:06 PM: Starting build script
6:08:06 PM: Installing dependencies
6:08:06 PM: Python version set to 2.7
6:08:07 PM: v12.18.0 is already installed.
6:08:08 PM: Now using node v12.18.0 (npm v6.14.4)
6:08:08 PM: Started restoring cached build plugins
6:08:08 PM: Finished restoring cached build plugins
6:08:09 PM: Attempting ruby version 2.7.1, read from environment
6:08:10 PM: Using ruby version 2.7.1
6:08:11 PM: Using PHP version 5.6
6:08:11 PM: Started restoring cached node modules
6:08:11 PM: Finished restoring cached node modules
6:08:11 PM: Installing NPM modules using NPM version 6.14.4
6:08:25 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
6:08:25 PM: > sanity-template-commercelayer@ postinstall /opt/build/repo
6:08:25 PM: > lerna bootstrap
6:08:25 PM: lerna notice cli v4.0.0
6:08:25 PM: lerna info ci enabled
6:08:25 PM: lerna info Bootstrapping 2 packages
6:08:25 PM: lerna info Installing external dependencies
6:09:06 PM: lerna info Symlinking packages and binaries
6:09:06 PM: lerna success Bootstrapped 2 packages
6:09:06 PM: npm WARN sanity-template-commercelayer@ No description
6:09:06 PM: npm WARN sanity-template-commercelayer@ No repository field.
6:09:06 PM: npm WARN sanity-template-commercelayer@ No license field.
6:09:06 PM: added 633 packages from 316 contributors and audited 633 packages in 54.554s
6:09:07 PM: 62 packages are looking for funding
6:09:07 PM:   run `npm fund` for details
6:09:07 PM: found 0 vulnerabilities
6:09:07 PM: NPM modules installed
6:09:07 PM: Started restoring cached go cache
6:09:07 PM: Finished restoring cached go cache
6:09:07 PM: go version go1.14.4 linux/amd64
6:09:07 PM: go version go1.14.4 linux/amd64
6:09:07 PM: Installing missing commands
6:09:07 PM: Verify run directory
6:09:10 PM: ​
6:09:10 PM: ────────────────────────────────────────────────────────────────
6:09:10 PM:   Netlify Build                                                 
6:09:10 PM: ────────────────────────────────────────────────────────────────
6:09:10 PM: ​
6:09:10 PM: ❯ Version
6:09:10 PM:   @netlify/build 9.10.2
6:09:10 PM: ​
6:09:10 PM: ❯ Flags
6:09:10 PM:   apiHost: api.netlify.com
6:09:10 PM:   cacheDir: /opt/build/cache
6:09:10 PM:   deployId: 6052376e349a6a0985ca5568
6:09:10 PM:   mode: buildbot
6:09:10 PM:   testOpts:
6:09:10 PM:     silentLingeringProcesses: ''
6:09:10 PM: ​
6:09:10 PM: ❯ Current directory
6:09:10 PM:   /opt/build/repo
6:09:10 PM: ​
6:09:10 PM: ❯ Config file
6:09:10 PM:   No config file was defined: using default values.
6:09:10 PM: ​
6:09:10 PM: ❯ Context
6:09:10 PM:   production
6:09:10 PM: ​
6:09:10 PM: ────────────────────────────────────────────────────────────────
6:09:10 PM:   1. Build command from Netlify app                             
6:09:10 PM: ────────────────────────────────────────────────────────────────
6:09:10 PM: ​
6:09:10 PM: $ npm run build-web
6:09:10 PM: > sanity-template-commercelayer@ build-web /opt/build/repo
6:09:10 PM: > lerna bootstrap && (cd web && npm run build)
6:09:11 PM: lerna notice cli v4.0.0
6:09:11 PM: lerna info ci enabled
6:09:11 PM: lerna info Bootstrapping 2 packages
6:09:11 PM: lerna info Installing external dependencies
6:09:34 PM: lerna info Symlinking packages and binaries
6:09:34 PM: lerna success Bootstrapped 2 packages
6:09:35 PM: > sanity-template-commercelayer-web@1.0.0 build /opt/build/repo/web
6:09:35 PM: > next build
6:09:37 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
6:09:37 PM: info  - Creating an optimized production build...
6:09:54 PM: warn - Tailwind is not purging unused styles because no template paths have been provided.
6:09:54 PM: warn - If you have manually configured PurgeCSS outside of Tailwind or are deliberately not removing unused styles, set `purge: false` in your Tailwind config file to silence this warning.
6:09:54 PM: warn - https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
6:11:13 PM: warn  - Compiled with warnings
6:11:13 PM: ./node_modules/next/dist/next-server/server/load-components.js
6:11:13 PM: Critical dependency: the request of a dependency is an expression
6:11:13 PM: ./node_modules/next/dist/next-server/server/load-components.js
6:11:13 PM: Critical dependency: the request of a dependency is an expression
6:11:13 PM: ./node_modules/next/dist/next-server/server/require.js
6:11:13 PM: Critical dependency: the request of a dependency is an expression
6:11:13 PM: ./node_modules/next/dist/next-server/server/require.js
6:11:13 PM: Critical dependency: the request of a dependency is an expression
6:11:13 PM: ./node_modules/next/dist/next-server/server/require.js
6:11:13 PM: Critical dependency: the request of a dependency is an expression
6:11:13 PM: info  - Collecting page data...
6:11:14 PM: info  - Generating static pages (0/5)
6:11:16 PM: info  - Generating static pages (1/5)
6:11:16 PM: info  - Generating static pages (2/5)
6:11:16 PM: Unhandled error during request: SerializableError: Error serializing `.cms` returned from `getStaticProps` in "/".
6:11:16 PM: Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.
6:11:16 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:95)
6:11:16 PM:     at /opt/build/repo/web/.next/serverless/pages/index.js:18838:490
6:11:16 PM:     at Array.every (<anonymous>)
6:11:16 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:291)
6:11:16 PM:     at isSerializableProps (/opt/build/repo/web/.next/serverless/pages/index.js:18840:219)
6:11:16 PM:     at renderToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:1189:1368)
6:11:16 PM:     at async renderReqToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:8463:334)
6:11:16 PM:     at async /opt/build/repo/web/node_modules/next/dist/export/worker.js:12:92
6:11:16 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
6:11:16 PM: info  - Generating static pages (3/5)
6:11:16 PM: Error occurred prerendering page "/". Read more: https://err.sh/next.js/prerender-error
6:11:16 PM: Error: Error serializing `.cms` returned from `getStaticProps` in "/".
6:11:16 PM: Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.
6:11:16 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:95)
6:11:16 PM:     at /opt/build/repo/web/.next/serverless/pages/index.js:18838:490
6:11:16 PM:     at Array.every (<anonymous>)
6:11:16 PM:     at isSerializable (/opt/build/repo/web/.next/serverless/pages/index.js:18838:291)
6:11:16 PM:     at isSerializableProps (/opt/build/repo/web/.next/serverless/pages/index.js:18840:219)
6:11:16 PM:     at renderToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:1189:1368)
6:11:16 PM:     at async renderReqToHTML (/opt/build/repo/web/.next/serverless/pages/index.js:8463:334)
6:11:16 PM:     at async /opt/build/repo/web/node_modules/next/dist/export/worker.js:12:92
6:11:16 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
6:11:16 PM: info  - Generating static pages (5/5)
6:11:16 PM: > Build error occurred
6:11:16 PM: Error: Export encountered errors on following paths:
6:11:16 PM: 	/
6:11:16 PM:     at /opt/build/repo/web/node_modules/next/dist/export/index.js:31:1103
6:11:16 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
6:11:16 PM:     at async /opt/build/repo/web/node_modules/next/dist/build/index.js:41:49
6:11:16 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
6:11:16 PM:     at async /opt/build/repo/web/node_modules/next/dist/build/index.js:23:1472
6:11:16 PM:     at async Span.traceAsyncFn (/opt/build/repo/web/node_modules/next/dist/telemetry/trace/trace.js:5:584)
6:11:16 PM: npm ERR! code ELIFECYCLE
6:11:16 PM: npm ERR! errno 1
6:11:16 PM: npm ERR! sanity-template-commercelayer-web@1.0.0 build: `next build`
6:11:16 PM: npm ERR! Exit status 1
6:11:16 PM: npm ERR!
6:11:16 PM: npm ERR! Failed at the sanity-template-commercelayer-web@1.0.0 build script.
6:11:16 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
6:11:16 PM: npm ERR! A complete log of this run can be found in:
6:11:16 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-03-17T17_11_16_684Z-debug.log
6:11:16 PM: npm ERR! code ELIFECYCLE
6:11:16 PM: npm ERR! errno 1
6:11:16 PM: npm ERR! sanity-template-commercelayer@ build-web: `lerna bootstrap && (cd web && npm run build)`
6:11:16 PM: npm ERR! Exit status 1
6:11:16 PM: npm ERR!
6:11:16 PM: npm ERR! Failed at the sanity-template-commercelayer@ build-web script.
6:11:16 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
6:11:16 PM: npm ERR! A complete log of this run can be found in:
6:11:16 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-03-17T17_11_16_704Z-debug.log
6:11:16 PM: ​
6:11:16 PM: ────────────────────────────────────────────────────────────────
6:11:16 PM:   "build.command" failed                                        
6:11:16 PM: ────────────────────────────────────────────────────────────────
6:11:16 PM: ​
6:11:16 PM:   Error message
6:11:16 PM:   Command failed with exit code 1: npm run build-web
6:11:16 PM: ​
6:11:16 PM:   Error location
6:11:16 PM:   In Build command from Netlify app:
6:11:16 PM:   npm run build-web
6:11:16 PM: ​
6:11:16 PM:   Resolved config
6:11:16 PM:   build:
6:11:16 PM:     base: /opt/build/repo
6:11:16 PM:     command: npm run build-web
6:11:16 PM:     commandOrigin: ui
6:11:16 PM:     publish: /opt/build/repo/web/out
6:11:16 PM: Caching artifacts
6:11:16 PM: Started saving node modules
6:11:16 PM: Finished saving node modules
6:11:16 PM: Started saving build plugins
6:11:16 PM: Finished saving build plugins
6:11:16 PM: Started saving pip cache
6:11:17 PM: Finished saving pip cache
6:11:17 PM: Started saving emacs cask dependencies
6:11:17 PM: Finished saving emacs cask dependencies
6:11:17 PM: Started saving maven dependencies
6:11:17 PM: Finished saving maven dependencies
6:11:17 PM: Started saving boot dependencies
6:11:17 PM: Finished saving boot dependencies
6:11:17 PM: Started saving rust rustup cache
6:11:17 PM: Finished saving rust rustup cache
6:11:17 PM: Started saving go dependencies
6:11:17 PM: Finished saving go dependencies
6:11:19 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:11:19 PM: Failing build: Failed to build site
6:11:19 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
6:11:20 PM: Finished processing build request in 3m19.881395585s

What else could I be doing wrong, please?

Do you think think there is a conflict with the previously set build settings here?

Hey there,

As we can see in the above log, your most recent builds are reading your netlify.toml file. We also checked on our end and confirmed that your recent builds are reading your netlify.toml file. Do you believe that this is incorrect?

Hi @hillary,

Thanks for your response. The above log actually did not read the config. I updated the Sanity build settings to reflect the changes I made previously based on your suggestion and it read the netlify.toml config file. :confetti_ball:

However, the production Nextjs project returns a blank white page when I open the product pages with a CSP policy warning but no errors. Here’s the web live here: https://bbb-sanity-commercelayer.netlify.app

For the studio, all assets return a 404 because the index.html is sort of in the root and assets are in /studio/static. I tried using the redirect rule below but it didn’t work as expected:

[[redirects]]
  from = "/studio/*"
  to = "/studio"
  status = 200

What do you suggest, please? Here’s the studio live: https://bbb-sanity-commercelayer-studio.netlify.app/

I tried re-deploying again after some changes, and I realized that Netlify reads the config during the build but fails to fetch the environmental variables set in netlify.toml. Strangely everything builds successfully now but doesn’t work as expected, and no env is used in production.

New test repo: GitHub - BolajiAyodeji/sss-sanity-commercelayer: SSS Commerce Layer Starter
Live preview: https://sss-sanity-commercelayer.netlify.app/

Build log:

6:59:02 PM: Build ready to start
6:59:03 PM: build-image version: 3571f0130496395a23bffe9820bc78b4f73a6234
6:59:03 PM: build-image tag: v3.7.0
6:59:03 PM: buildbot version: c8ebd612d11de8df807ee80082ae1ebcb899414f
6:59:03 PM: Fetching cached dependencies
6:59:04 PM: Starting to download cache of 157.4MB
6:59:05 PM: Finished downloading cache in 1.315561322s
6:59:05 PM: Starting to extract cache
6:59:12 PM: Finished extracting cache in 7.027558827s
6:59:12 PM: Finished fetching cache in 8.393991238s
6:59:12 PM: Starting to prepare the repo for build
6:59:12 PM: Preparing Git Reference refs/heads/main
6:59:15 PM: Starting build script
6:59:15 PM: Installing dependencies
6:59:15 PM: Python version set to 2.7
6:59:15 PM: Started restoring cached node version
6:59:18 PM: Finished restoring cached node version
6:59:19 PM: v12.18.0 is already installed.
6:59:20 PM: Now using node v12.18.0 (npm v6.14.4)
6:59:20 PM: Started restoring cached build plugins
6:59:20 PM: Finished restoring cached build plugins
6:59:20 PM: Attempting ruby version 2.7.1, read from environment
6:59:21 PM: Using ruby version 2.7.1
6:59:22 PM: Using PHP version 5.6
6:59:22 PM: Started restoring cached node modules
6:59:22 PM: Finished restoring cached node modules
6:59:22 PM: Started restoring cached go cache
6:59:22 PM: Finished restoring cached go cache
6:59:22 PM: go version go1.14.4 linux/amd64
6:59:22 PM: go version go1.14.4 linux/amd64
6:59:22 PM: Installing missing commands
6:59:22 PM: Verify run directory
6:59:24 PM: ​
6:59:24 PM: ────────────────────────────────────────────────────────────────
6:59:24 PM:   Netlify Build                                                 
6:59:24 PM: ────────────────────────────────────────────────────────────────
6:59:24 PM: ​
6:59:24 PM: ❯ Version
6:59:24 PM:   @netlify/build 9.10.2
6:59:24 PM: ​
6:59:24 PM: ❯ Flags
6:59:24 PM:   apiHost: api.netlify.com
6:59:24 PM:   cacheDir: /opt/build/cache
6:59:24 PM:   deployId: 605394e5eec9dd000742aaaa
6:59:24 PM:   mode: buildbot
6:59:24 PM:   testOpts:
6:59:24 PM:     silentLingeringProcesses: ''
6:59:24 PM: ​
6:59:24 PM: ❯ Current directory
6:59:24 PM:   /opt/build/repo/web
6:59:24 PM: ​
6:59:24 PM: ❯ Config file
6:59:24 PM:   /opt/build/repo/web/netlify.toml
6:59:24 PM: ​
6:59:24 PM: ❯ Context
6:59:24 PM:   production
6:59:24 PM: ​
6:59:24 PM: ❯ Loading plugins
6:59:24 PM:    - @netlify/plugin-nextjs@3.0.3 from netlify.toml and package.json
6:59:25 PM: ​
6:59:25 PM: ────────────────────────────────────────────────────────────────
6:59:25 PM:   1. onPreBuild command from @netlify/plugin-nextjs             
6:59:25 PM: ────────────────────────────────────────────────────────────────
6:59:25 PM: ​
6:59:26 PM: ​
6:59:26 PM: (@netlify/plugin-nextjs onPreBuild completed in 1s)
6:59:26 PM: ​
6:59:26 PM: ────────────────────────────────────────────────────────────────
6:59:26 PM:   2. build.command from netlify.toml                            
6:59:26 PM: ────────────────────────────────────────────────────────────────
6:59:26 PM: ​
6:59:26 PM: $ npm run build
6:59:26 PM: > sanity-template-commercelayer-web@1.0.0 build /opt/build/repo/web
6:59:26 PM: > next build
6:59:28 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
6:59:28 PM: info  - Creating an optimized production build...
6:59:43 PM: warn - Tailwind is not purging unused styles because no template paths have been provided.
6:59:43 PM: warn - If you have manually configured PurgeCSS outside of Tailwind or are deliberately not removing unused styles, set `purge: false` in your Tailwind config file to silence this warning.
6:59:43 PM: warn - https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
7:00:50 PM: warn  - Compiled with warnings
7:00:50 PM: ./node_modules/next/dist/next-server/server/load-components.js
7:00:50 PM: Critical dependency: the request of a dependency is an expression
7:00:50 PM: ./node_modules/next/dist/next-server/server/load-components.js
7:00:50 PM: Critical dependency: the request of a dependency is an expression
7:00:50 PM: ./node_modules/next/dist/next-server/server/require.js
7:00:50 PM: Critical dependency: the request of a dependency is an expression
7:00:50 PM: ./node_modules/next/dist/next-server/server/require.js
7:00:50 PM: Critical dependency: the request of a dependency is an expression
7:00:50 PM: ./node_modules/next/dist/next-server/server/require.js
7:00:50 PM: Critical dependency: the request of a dependency is an expression
7:00:50 PM: info  - Collecting page data...
7:00:51 PM: You have set `useCdn` to `true` while also specifying a token. This is usually not what you want. The CDN cannot be used with an authorization token, since private data cannot be cached. See https://docs.sanity.io/help/js-client-usecdn-token for more information.
7:00:51 PM: You have set `useCdn` to `true` while also specifying a token. This is usually not what you want. The CDN cannot be used with an authorization token, since private data cannot be cached. See https://docs.sanity.io/help/js-client-usecdn-token for more information.
7:00:51 PM: You have set `useCdn` to `true` while also specifying a token. This is usually not what you want. The CDN cannot be used with an authorization token, since private data cannot be cached. See https://docs.sanity.io/help/js-client-usecdn-token for more information.
7:00:52 PM: info  - Generating static pages (0/5)
7:00:53 PM: info  - Generating static pages (1/5)
7:00:53 PM: info  - Generating static pages (2/5)
7:00:53 PM: You have set `useCdn` to `true` while also specifying a token. This is usually not what you want. The CDN cannot be used with an authorization token, since private data cannot be cached. See https://docs.sanity.io/help/js-client-usecdn-token for more information.
7:00:53 PM: You have set `useCdn` to `true` while also specifying a token. This is usually not what you want. The CDN cannot be used with an authorization token, since private data cannot be cached. See https://docs.sanity.io/help/js-client-usecdn-token for more information.
7:00:53 PM: info  - Generating static pages (3/5)
7:00:53 PM: You have set `useCdn` to `true` while also specifying a token. This is usually not what you want. The CDN cannot be used with an authorization token, since private data cannot be cached. See https://docs.sanity.io/help/js-client-usecdn-token for more information.
7:00:53 PM: info  - Generating static pages (5/5)
7:00:53 PM: info  - Finalizing page optimization...
7:00:53 PM: Page                                 Size     First Load JS
7:00:53 PM: ┌ ● /                                743 B           204 kB
7:00:53 PM: ├   /_app                            0 B              67 kB
7:00:53 PM: ├ ● /[countryCode]/[lang]            30.2 kB         241 kB
7:00:53 PM: ├ ● /[countryCode]/[lang]/[product]  1.92 kB         213 kB
7:00:53 PM: ├ ○ /404                             2.73 kB        69.8 kB
7:00:53 PM: └ λ /api                             0 B              67 kB
7:00:53 PM: + First Load JS shared by all        67 kB
7:00:53 PM:   ├ chunks/commons.775ba5.js         17.3 kB
7:00:53 PM:   ├ chunks/framework.d2e618.js       42.1 kB
7:00:53 PM:   ├ chunks/main.760192.js            6.36 kB
7:00:53 PM:   ├ chunks/pages/_app.1a876f.js      566 B
7:00:53 PM:   ├ chunks/webpack.50bee0.js         751 B
7:00:53 PM:   └ css/6f152eb9eea342ef61c7.css     316 kB
7:00:53 PM: λ  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
7:00:53 PM: ○  (Static)  automatically rendered as static HTML (uses no initial props)
7:00:53 PM: ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
7:00:53 PM:    (ISR)     incremental static regeneration (uses revalidate in getStaticProps)
7:00:54 PM: ​
7:00:54 PM: (build.command completed in 1m 27.9s)
7:00:54 PM: ​
7:00:54 PM: ────────────────────────────────────────────────────────────────
7:00:54 PM:   3. onBuild command from @netlify/plugin-nextjs                
7:00:54 PM: ────────────────────────────────────────────────────────────────
7:00:54 PM: ​
7:00:54 PM: ** Running Next on Netlify package **
7:00:54 PM: 🚀 Next on Netlify 🚀
7:00:54 PM: 🌍️ Copying public/ folder to out
7:00:54 PM: 💼 Copying static NextJS assets to out
7:00:54 PM: 💫 Setting up API endpoints as Netlify Functions in netlify/functions
7:00:54 PM: 💫 Setting up pages with getInitialProps as Netlify Functions in netlify/functions
7:00:54 PM: 💫 Setting up pages with getServerSideProps as Netlify Functions in netlify/functions
7:00:54 PM: 🔥 Copying pre-rendered pages with getStaticProps and JSON data to out
7:00:54 PM: 💫 Setting up pages with getStaticProps and fallback: true as Netlify Functions in netlify/functions
7:00:54 PM: 💫 Setting up pages with getStaticProps and revalidation interval as Netlify Functions in netlify/functions
7:00:54 PM: 🔥 Copying pre-rendered pages without props to out
7:00:54 PM: 🔀 Setting up redirects
7:00:54 PM: 🔀 Setting up headers
7:00:54 PM: ✅ Success! All done!
7:00:54 PM: ​
7:00:54 PM: (@netlify/plugin-nextjs onBuild completed in 734ms)
7:00:54 PM: ​
7:00:54 PM: ────────────────────────────────────────────────────────────────
7:00:54 PM:   4. Functions bundling                                         
7:00:54 PM: ────────────────────────────────────────────────────────────────
7:00:54 PM: ​
7:00:54 PM: Packaging Functions from netlify/functions directory:
7:00:54 PM:  - next_image.js
7:00:54 PM:  - next_api/next_api.js
7:00:54 PM:  - next_countryCode_lang/next_countryCode_lang.js
7:00:54 PM:  - next_countryCode_lang_product/next_countryCode_lang_product.js
7:00:54 PM:  - next_index/next_index.js
7:01:40 PM: ​
7:01:40 PM: (Functions bundling completed in 45.9s)
7:01:40 PM: ​
7:01:40 PM: ────────────────────────────────────────────────────────────────
7:01:40 PM:   5. Deploy site                                                
7:01:40 PM: ────────────────────────────────────────────────────────────────
7:01:40 PM: ​
7:01:40 PM: Starting to deploy site from 'web/out'
7:01:41 PM: Creating deploy tree 
7:01:41 PM: Creating deploy upload records
7:01:41 PM: 3 new files to upload
7:01:41 PM: 5 new functions to upload
7:01:44 PM: Site deploy was successfully initiated
7:01:44 PM: ​
7:01:44 PM: (Deploy site completed in 3.5s)
7:01:44 PM: Starting post processing
7:01:44 PM: ​
7:01:44 PM: ────────────────────────────────────────────────────────────────
7:01:44 PM:   Netlify Build Complete                                        
7:01:44 PM: ────────────────────────────────────────────────────────────────
7:01:44 PM: ​
7:01:44 PM: (Netlify Build completed in 2m 19.8s)
7:01:44 PM: Post processing - HTML
7:01:44 PM: Caching artifacts
7:01:44 PM: Started saving node modules
7:01:44 PM: Finished saving node modules
7:01:44 PM: Started saving build plugins
7:01:44 PM: Finished saving build plugins
7:01:44 PM: Started saving pip cache
7:01:44 PM: Post processing - header rules
7:01:44 PM: Post processing - redirect rules
7:01:44 PM: Finished saving pip cache
7:01:44 PM: Started saving emacs cask dependencies
7:01:44 PM: Finished saving emacs cask dependencies
7:01:44 PM: Started saving maven dependencies
7:01:44 PM: Finished saving maven dependencies
7:01:44 PM: Started saving boot dependencies
7:01:44 PM: Post processing done
7:01:44 PM: Finished saving boot dependencies
7:01:44 PM: Started saving rust rustup cache
7:01:44 PM: Finished saving rust rustup cache
7:01:44 PM: Started saving go dependencies
7:01:44 PM: Finished saving go dependencies
7:01:44 PM: Build script success
7:01:44 PM: Site is live ✨
7:02:15 PM: Finished processing build request in 3m12.09854089s

UPDATE: I added the environmental variables to the build settings in Netlify’s UI and it worked as expected. How do I get Netlify to read my env as seen here, please?

Update:

We’ve figured out another way to get env into the build and it works perfectly (hence the previous test repos I shared are deleted already). The only issue left is with the redirect for studio. You can test the issue and see the error here: https://rp-sanity-commercelayer-studio.netlify.app/

I’ll appreciate your help, please. Thank you!

Hi @hillary, thanks for your help!

Everything works fine now. The build path suggestion fixed my first issue and updating my sanity configuration fixed the file path redirect issue.

1 Like

Hey there, @BolajiAyodeji :wave:

So glad this is working for you! :netliconfetti: Thank you for confirming the steps you took that solved this problem. This will help future Forums members if they encounter something similar.