Nextjs build don't pickup dynamic robots/txtsitemap.xml generated by next-sitemap

Hello team,

I have a problem on my NextJs deployment, My sitemap.xml is not uploaded.
Sitename : https://linkyflow.netlify.app

I use

  • Nrwl monorepo
  • Nextjs
  • next-sitemap

Application is deployed on dist/apps/front and is uploading fine.
Next-sitemap is a npm module that create robots.txt and sitemap.xml and place them in nextjs public folder.
In a monorepo, we can configure it to place the robots.txt / sitemap.xml in dist/apps/front/public folder.

It works fine in local, meaning that when I run “next build” and “next-sitemap”, it creates the nextjs build in dist/apps/front and upload the robots.txt / sitemap.xml in the dist/apps/front/public.

Problem is that on the netlify deploy, next-sitemap is working fine, but the robots.txt / sitemap.xml are not being uploaded to the website (see build details below, where we can’t see the redirects on robots.txt / sitemap.xml

netlify.toml :

[build]
  base = "."
  publish = "./dist/apps/front/.next"
  command = "yarn run build:stg"

[context.prod] 
  command = "yarn run build:prod"

[[plugins]]
  package = "@netlify/plugin-nextjs"

package.json for command build

env-cmd -f ./apps/front/.env.production nx run front:build:production && env-cmd -f ./apps/front/.env.production  nx run front:sitemap

project.json (nrwl where we have the command sitemap, the front:build:production is a standard next build)

    "sitemap": {
      "executor": "nx:run-commands",
      "options": {
        "command": "next-sitemap --config apps/front/next-sitemap.config.js"
      }
    },

next-sitemap.config.js for sitemap config

/** @type {import('next-sitemap').IConfig} */
module.exports = {
  siteUrl: process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:4200',
  generateRobotsTxt: true,
  sourceDir: 'dist/apps/front/.next',
  outDir: 'dist/apps/front/public',
  robotsTxtOptions: {
    policies: [
      {
        userAgent: '*',
        allow: process.env.NODE_ENV === 'production' ? '/' : '',
        disallow: process.env.NODE_ENV === 'production' ? '' : '/',
      },
    ],
  },
  exclude: ['/me/*', '/auth/*', '/terms', '/app', '/app/*', '/success', '/404'],
};

Build logs :

5:23:58 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
5:23:58 PM: build-image tag: v4.16.1
5:23:58 PM: buildbot version: a1ec8307ac4591dcd155485cdfce7d7be735ab26
5:23:59 PM: Fetching cached dependencies
5:23:59 PM: Starting to download cache of 2.1GB
5:24:09 PM: Finished downloading cache in 10.63398259s
5:24:09 PM: Starting to extract cache
5:24:23 PM: Finished extracting cache in 13.363973776s
5:24:23 PM: Finished fetching cache in 24.373784858s
5:24:23 PM: Starting to prepare the repo for build
5:24:23 PM: Preparing Git Reference refs/heads/prod
5:24:24 PM: Parsing package.json dependencies
5:24:25 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'yarn run build:prod' versus 'npm run build:prod' in the Netlify UI
5:24:25 PM: Starting build script
5:24:25 PM: Installing dependencies
5:24:25 PM: Python version set to 2.7
5:24:25 PM: Started restoring cached node version
5:24:32 PM: Finished restoring cached node version
5:24:32 PM: v16.19.0 is already installed.
5:24:33 PM: Now using node v16.19.0 (npm v8.19.3)
5:24:33 PM: Enabling node corepack
5:24:33 PM: Started restoring cached build plugins
5:24:33 PM: Finished restoring cached build plugins
5:24:33 PM: Attempting ruby version 2.7.2, read from environment
5:24:33 PM: Using ruby version 2.7.2
5:24:34 PM: Using PHP version 8.0
5:24:34 PM: WARNING: The environment variable 'NODE_ENV' is set to 'production'. Any 'devDependencies' in package.json will not be installed
5:24:34 PM: Started restoring cached yarn cache
5:25:05 PM: Finished restoring cached yarn cache
5:25:06 PM: No yarn workspaces detected
5:25:06 PM: Started restoring cached node modules
5:25:06 PM: Finished restoring cached node modules
5:25:06 PM: Installing NPM modules using Yarn version 1.22.19
5:25:06 PM: yarn install v1.22.19
5:25:06 PM: [1/4] Resolving packages...
5:25:07 PM: success Already up-to-date.
5:25:07 PM: Done in 0.74s.
5:25:07 PM: NPM modules installed using Yarn
5:25:07 PM: Started restoring cached go cache
5:25:07 PM: Finished restoring cached go cache
5:25:08 PM: go version go1.19.4 linux/amd64
5:25:08 PM: Detected 1 framework(s)
5:25:08 PM: "next-nx" at version "15.4.4"
5:25:08 PM: Installing missing commands
5:25:08 PM: Verify run directory
5:25:08 PM: Section completed: initializing
5:25:09 PM: ​
5:25:09 PM:   Netlify Build                                                 
5:25:09 PM: ────────────────────────────────────────────────────────────────
5:25:09 PM: ​
5:25:09 PM: ❯ Version
5:25:09 PM:   @netlify/build 29.4.0
5:25:09 PM: ​
5:25:09 PM: ❯ Flags
5:25:09 PM:   baseRelDir: true
5:25:09 PM:   buildId: 63baee1dc3156500081bfd5c
5:25:09 PM:   deployId: 63baee1dc3156500081bfd5e
5:25:09 PM: ​
5:25:09 PM: ❯ Current directory
5:25:09 PM:   /opt/build/repo
5:25:09 PM: ​
5:25:09 PM: ❯ Config file
5:25:09 PM:   /opt/build/repo/netlify.toml
5:25:09 PM: ​
5:25:09 PM: ❯ Context
5:25:09 PM:   production
5:25:10 PM: ​
5:25:10 PM: ❯ Using Next.js Runtime - v4.29.4
5:25:11 PM: ​
5:25:11 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
5:25:11 PM: ────────────────────────────────────────────────────────────────
5:25:11 PM: ​
5:25:11 PM: Next.js cache restored.
5:25:11 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
5:25:11 PM: ​
5:25:11 PM: (@netlify/plugin-nextjs onPreBuild completed in 407ms)
5:25:11 PM: ​
5:25:11 PM:   2. build.command from netlify.toml                            
5:25:11 PM: ────────────────────────────────────────────────────────────────
5:25:11 PM: ​
5:25:11 PM: $ yarn run build:prod
5:25:11 PM: yarn run v1.22.19
5:25:12 PM: $ env-cmd -f ./apps/front/.env.production nx run front:build:production && env-cmd -f ./apps/front/.env.production  nx run front:sitemap 
5:25:13 PM: > nx run front:build:production
5:25:15 PM: info  - Loaded env from apps/front/.env.production
5:25:15 PM: info  - Loaded env from apps/front/.env
5:25:15 PM: info  - Skipping linting
5:25:15 PM: info  - Checking validity of types...
5:25:21 PM: info  - Creating an optimized production build...
5:25:25 PM: info  - Compiled successfully
5:25:25 PM: info  - Collecting page data...
5:25:29 PM: info  - Generating static pages (0/13)
5:25:30 PM: info  - Generating static pages (3/13)
5:25:31 PM: info  - Generating static pages (6/13)
5:25:31 PM: undefined
5:25:31 PM: info  - Generating static pages (9/13)
5:25:31 PM: info  - Generating static pages (13/13)
5:25:31 PM: info  - Finalizing page optimization...
5:25:31 PM: Route (pages)                                                                          Size     First Load JS
5:25:31 PM: ┌ ○ / (1868 ms)                                                                        7.07 kB         147 kB
5:25:31 PM: ├   /_app                                                                              0 B             117 kB
5:25:31 PM: ├ ○ /404 (1573 ms)                                                                     2.13 kB         132 kB
5:25:31 PM: ├ λ /api/auth/[...nextauth]                                                            0 B             117 kB
5:25:31 PM: ├ ○ /app/dashboard (2077 ms)                                                           109 kB          257 kB
5:25:31 PM: ├ ○ /app/export (1989 ms)                                                              760 B           174 kB
5:25:31 PM: ├ ○ /app/import (1887 ms)                                                              29.6 kB         190 kB
5:25:31 PM: ├ ○ /app/mapping (1832 ms)                                                             7.5 kB          159 kB
5:25:31 PM: ├ ○ /app/transaction (1972 ms)                                                         667 B           174 kB
5:25:31 PM: ├ λ /auth/signin                                                                       798 B           118 kB
5:25:31 PM: ├ ○ /auth/signout (1415 ms)                                                            388 B           117 kB
5:25:31 PM: ├ ○ /auth/verify-request (1498 ms)                                                     361 B           117 kB
5:25:31 PM: ├ ● /blog (1698 ms)                                                                    4.67 kB         143 kB
5:25:31 PM: ├ ● /blog/[slug] (1956 ms)                                                             35 kB           173 kB
5:25:31 PM: ├   └ /blog/should-you-use-crypto-assets-as-part-of-your-liquidity-strategy (1956 ms)
5:25:31 PM: └ ○ /success (1604 ms)                                                                 2.1 kB          132 kB
5:25:31 PM: + First Load JS shared by all                                                          119 kB
5:25:31 PM:   ├ chunks/framework-5bb4f355ac165f9a.js                                               45.4 kB
5:25:31 PM:   ├ chunks/main-c48f935e0dcc8395.js                                                    27.2 kB
5:25:31 PM:   ├ chunks/pages/_app-b9e4221c60d024ca.js                                              43.3 kB
5:25:31 PM:   ├ chunks/webpack-36d12a75f0098f30.js                                                 1.04 kB
5:25:31 PM:   └ css/574084a258343374.css                                                           2.05 kB
5:25:31 PM: λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
5:25:31 PM: ○  (Static)  automatically rendered as static HTML (uses no initial props)
5:25:31 PM: ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
5:25:32 PM:  >  NX   Successfully ran target build for project front
5:25:32 PM: > nx run front:sitemap
5:25:33 PM: ✨ [next-sitemap] Loading next-sitemap config: file:///opt/build/repo/apps/front/next-sitemap.config.js
5:25:33 PM: ✅ [next-sitemap] Generation completed
5:25:33 PM: ┌───────────────┬────────┐
5:25:33 PM: │    (index)    │ Values │
5:25:33 PM: ├───────────────┼────────┤
5:25:33 PM: │ indexSitemaps │   1    │
5:25:33 PM: │   sitemaps    │   1    │
5:25:33 PM: └───────────────┴────────┘
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:  SITEMAP INDICES
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:    ○ https://linkyflow.com/sitemap.xml
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:  SITEMAPS
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:    ○ https://linkyflow.com/sitemap-0.xml
5:25:33 PM:  >  NX   Successfully ran target sitemap for project front
5:25:33 PM: $ env-cmd -f ./apps/front/.env.production next-sitemap --config apps/front/next-sitemap.config.js
5:25:33 PM: ✨ [next-sitemap] Loading next-sitemap config: file:///opt/build/repo/apps/front/next-sitemap.config.js
5:25:33 PM: ✅ [next-sitemap] Generation completed
5:25:33 PM: ┌───────────────┬────────┐
5:25:33 PM: │    (index)    │ Values │
5:25:33 PM: ├───────────────┼────────┤
5:25:33 PM: │ indexSitemaps │   1    │
5:25:33 PM: │   sitemaps    │   1    │
5:25:33 PM: └───────────────┴────────┘
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:  SITEMAP INDICES
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:    ○ https://linkyflow.com/sitemap.xml
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:  SITEMAPS
5:25:33 PM: -----------------------------------------------------
5:25:33 PM:    ○ https://linkyflow.com/sitemap-0.xml
5:25:33 PM: Done in 21.21s.
5:25:33 PM: ​
5:25:33 PM: (build.command completed in 21.3s)
5:25:33 PM: ​
5:25:33 PM:   3. @netlify/plugin-nextjs (onBuild event)                     
5:25:33 PM: ────────────────────────────────────────────────────────────────
5:25:33 PM: ​
5:25:33 PM: NextAuth package detected, NEXTAUTH_URL environment variable set by user in Netlify configuration to https://linkyflow.com
5:25:33 PM: Patching /opt/build/repo/node_modules/next/dist/server/base-server.js
5:25:33 PM: Done
5:25:33 PM: Patching /opt/build/repo/node_modules/next/dist/server/next-server.js
5:25:33 PM: Done
5:25:33 PM: Moving static page files to serve from CDN...
5:25:33 PM: Moved 13 files
5:25:33 PM: Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.
5:25:33 PM: Netlify configuration property "redirects" value changed to [
5:25:33 PM:   { from: '/_next/static/*', to: '/static/:splat', status: 200 },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/image*',
5:25:33 PM:     query: { url: ':url', w: ':width', q: ':quality' },
5:25:33 PM:     to: '/_ipx/w_:width,q_:quality/:url',
5:25:33 PM:     status: 301
5:25:33 PM:   },
5:25:33 PM:   { from: '/_ipx/*', to: '/.netlify/builders/_ipx', status: 200 },
5:25:33 PM:   { from: '/cache/*', to: '/404.html', status: 404, force: true },
5:25:33 PM:   { from: '/server/*', to: '/404.html', status: 404, force: true },
5:25:33 PM:   { from: '/serverless/*', to: '/404.html', status: 404, force: true },
5:25:33 PM:   { from: '/trace', to: '/404.html', status: 404, force: true },
5:25:33 PM:   { from: '/traces', to: '/404.html', status: 404, force: true },
5:25:33 PM:   {
5:25:33 PM:     from: '/routes-manifest.json',
5:25:33 PM:     to: '/404.html',
5:25:33 PM:     status: 404,
5:25:33 PM:     force: true
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/build-manifest.json',
5:25:33 PM:     to: '/404.html',
5:25:33 PM:     status: 404,
5:25:33 PM:     force: true
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/prerender-manifest.json',
5:25:33 PM:     to: '/404.html',
5:25:33 PM:     status: 404,
5:25:33 PM:     force: true
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/react-loadable-manifest.json',
5:25:33 PM:     to: '/404.html',
5:25:33 PM:     status: 404,
5:25:33 PM:     force: true
5:25:33 PM:   },
5:25:33 PM:   { from: '/BUILD_ID', to: '/404.html', status: 404, force: true },
5:25:33 PM:   {
5:25:33 PM:     from: '/api/*',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/404.svg',
5:25:33 PM:     to: '/404.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/favicon.svg',
5:25:33 PM:     to: '/favicon.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/logo.svg',
5:25:33 PM:     to: '/logo.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/robots.txt',
5:25:33 PM:     to: '/robots.txt',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/sitemap-0.xml',
5:25:33 PM:     to: '/sitemap-0.xml',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/sitemap.xml',
5:25:33 PM:     to: '/sitemap.xml',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/success.svg',
5:25:33 PM:     to: '/success.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/admin/config.yml',
5:25:33 PM:     to: '/admin/config.yml',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/admin/index.html',
5:25:33 PM:     to: '/admin/index.html',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/home/crypto_portfolio.svg',
5:25:33 PM:     to: '/home/crypto_portfolio.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/home/data_processing.svg',
5:25:33 PM:     to: '/home/data_processing.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/home/data_re.svg',
5:25:33 PM:     to: '/home/data_re.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/home/receipt.svg',
5:25:33 PM:     to: '/home/receipt.svg',
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     status: 200
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/*',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     conditions: { Cookie: [Array] },
5:25:33 PM:     force: true
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/index.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/app/dashboard.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/app/dashboard',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/app/export.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/app/export',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/app/import.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/app/import',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/app/mapping.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/app/mapping',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/app/transaction.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/app/transaction',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/auth/signin.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/auth/signin',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/auth/signout.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/auth/signout',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/auth/verify-request.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/auth/verify-request',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/success.json',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/success',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/_next/data/bzmU4ww5gJNrzMaH-S7Wo/blog/:slug.json',
5:25:33 PM:     to: '/server/pages/404.html',
5:25:33 PM:     status: 404,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/blog/:slug',
5:25:33 PM:     to: '/server/pages/404.html',
5:25:33 PM:     status: 404,
5:25:33 PM:     force: false
5:25:33 PM:   },
5:25:33 PM:   {
5:25:33 PM:     from: '/*',
5:25:33 PM:     to: '/.netlify/functions/___netlify-handler',
5:25:33 PM:     status: 200
5:25:33 PM:   }
5:25:33 PM: ].
5:25:33 PM: ​
5:25:33 PM: (@netlify/plugin-nextjs onBuild completed in 278ms)
5:25:33 PM: ​
5:25:33 PM:   4. Functions bundling                                         
5:25:33 PM: ────────────────────────────────────────────────────────────────
5:25:33 PM: ​
5:25:33 PM: Packaging Functions from .netlify/functions-internal directory:
5:25:33 PM:  - ___netlify-handler/___netlify-handler.js
5:25:33 PM:  - ___netlify-odb-handler/___netlify-odb-handler.js
5:25:33 PM:  - _ipx/_ipx.js
5:25:33 PM: ​
5:26:02 PM: ​
5:26:02 PM: (Functions bundling completed in 28.8s)
5:26:02 PM: ​
5:26:02 PM:   5. Edge Functions bundling                                    
5:26:02 PM: ────────────────────────────────────────────────────────────────
5:26:02 PM: ​
5:26:02 PM: Packaging Edge Functions from .netlify/edge-functions directory:
5:26:02 PM:  - ipx
5:26:03 PM: ​
5:26:03 PM: (Edge Functions bundling completed in 1s)
5:26:03 PM: ​
5:26:03 PM:   6. @netlify/plugin-nextjs (onPostBuild event)                 
5:26:03 PM: ────────────────────────────────────────────────────────────────
5:26:03 PM: ​
5:26:03 PM: Next.js cache saved.
5:26:03 PM: ​
5:26:03 PM: (@netlify/plugin-nextjs onPostBuild completed in 165ms)
5:26:03 PM: ​
5:26:03 PM:   7. Deploy site                                                
5:26:03 PM: ────────────────────────────────────────────────────────────────
5:26:03 PM: ​
5:26:03 PM: Starting to deploy site from 'dist/apps/front/.next'
5:26:03 PM: Creating deploy tree 
5:26:04 PM: 34 new files to upload
5:26:04 PM: 3 new functions to upload
5:26:13 PM: Section completed: deploying
5:26:13 PM: Site deploy was successfully initiated
5:26:13 PM: ​
5:26:13 PM: (Deploy site completed in 9.5s)
5:26:13 PM: ​
5:26:13 PM:   Netlify Build Complete                                        
5:26:13 PM: Starting post processing
5:26:13 PM: ────────────────────────────────────────────────────────────────
5:26:13 PM: ​
5:26:13 PM: (Netlify Build completed in 1m 3.3s)
5:26:13 PM: Post processing - HTML
5:26:13 PM: Caching artifacts
5:26:13 PM: Started saving node modules
5:26:13 PM: Finished saving node modules
5:26:13 PM: Started saving build plugins
5:26:13 PM: Finished saving build plugins
5:26:13 PM: Started saving yarn cache
5:26:14 PM: Post processing - header rules
5:26:14 PM: Post processing - redirect rules
5:26:14 PM: Post processing done
5:26:14 PM: Section completed: postprocessing
5:26:19 PM: Site is live ✨
5:26:42 PM: Finished saving yarn cache
5:26:42 PM: Started saving pip cache
5:26:42 PM: Finished saving pip cache
5:26:42 PM: Started saving emacs cask dependencies
5:26:42 PM: Finished saving emacs cask dependencies
5:26:42 PM: Started saving maven dependencies
5:26:42 PM: Finished saving maven dependencies
5:26:42 PM: Started saving boot dependencies
5:26:42 PM: Finished saving boot dependencies
5:26:42 PM: Started saving rust rustup cache
5:26:42 PM: Finished saving rust rustup cache
5:26:42 PM: Started saving go dependencies
5:26:42 PM: Finished saving go dependencies
5:26:42 PM: Build script success
5:26:42 PM: Section completed: building
5:29:41 PM: Uploading Cache of size 2.1GB
5:29:53 PM: Section completed: cleanup
5:29:53 PM: Finished processing build request in 5m54.355841172s

Thank you ! I have been searching for 5hours and I have no idea what to do.

Best,
Fabien

The sitemap should exist in public folder before you run next build. OR, copy it directly to .next folder after you run next build.

OK ! Many thanks to you !
For anyone wondering, I did the following modification and it works now.

...
  outDir: 'dist/apps/front/.next',
...