Build load of serverless function in next production build in netlify not working

My issue is that I have a serverless function in a js filed called CRUDFLData.js which is compiled well locally when running Netlify dev but when I push my project to github and deploy to netlify the production version build does not load/compile this serverless function file. The function is not visible in the Netlify function logs at all.

Site name: https://ankiologernasnl.netlify.app/)

Build log:
3:57:30 PM: build-image version: 3ffff9df3d5419545acc1b673a54de348174406d (focal)
3:57:30 PM: buildbot version: d87b55aad19e546266bee69776544e7982adf445
3:57:30 PM: Fetching cached dependencies
3:57:30 PM: Starting to download cache of 185.1MB
3:57:32 PM: Finished downloading cache in 1.858s
3:57:32 PM: Starting to extract cache
3:57:36 PM: Finished extracting cache in 3.798s
3:57:36 PM: Finished fetching cache in 5.716s
3:57:36 PM: Starting to prepare the repo for build
3:57:36 PM: Preparing Git Reference refs/heads/master
3:57:37 PM: Custom functions path detected. Proceeding with the specified path: “netlify/functions”
3:57:37 PM: Starting to install dependencies
3:57:37 PM: Python version set to 3.8
3:57:37 PM: Attempting Ruby version 2.7.2, read from environment
3:57:38 PM: Using Ruby version 2.7.2
3:57:38 PM: Started restoring cached go cache
3:57:38 PM: Finished restoring cached go cache
3:57:39 PM: go version go1.19.13 linux/amd64
3:57:40 PM: Using PHP version 8.0
3:57:40 PM: Started restoring cached Node.js version
3:57:41 PM: Finished restoring cached Node.js version
3:57:42 PM: v18.19.0 is already installed.
3:57:42 PM: Now using node v18.19.0 (npm v10.2.3)
3:57:42 PM: Enabling Node.js Corepack
3:57:42 PM: Started restoring cached build plugins
3:57:42 PM: Finished restoring cached build plugins
3:57:42 PM: Started restoring cached corepack dependencies
3:57:42 PM: Finished restoring cached corepack dependencies
3:57:42 PM: No npm workspaces detected
3:57:42 PM: Started restoring cached node modules
3:57:42 PM: Finished restoring cached node modules
3:57:43 PM: Installing npm packages using npm version 10.2.3
3:57:45 PM: up to date, audited 279 packages in 2s
3:57:45 PM: 38 packages are looking for funding
3:57:45 PM: run npm fund for details
3:57:45 PM: 11 vulnerabilities (3 moderate, 7 high, 1 critical)
3:57:45 PM: To address issues that do not require attention, run:
3:57:45 PM: npm audit fix
3:57:45 PM: To address all issues (including breaking changes), run:
3:57:45 PM: npm audit fix --force
3:57:45 PM: Run npm audit for details.
3:57:45 PM: npm packages installed
3:57:45 PM: Successfully installed dependencies
3:57:45 PM: Starting build script
3:57:46 PM: Detected 1 framework(s)
3:57:46 PM: “next” at version “12.3.4”
3:57:46 PM: Section completed: initializing
3:57:48 PM: ​
3:57:48 PM: Netlify Build
3:57:48 PM: ────────────────────────────────────────────────────────────────
3:57:48 PM: ​
3:57:48 PM: ❯ Version
3:57:48 PM: @netlify/build 29.29.4
3:57:48 PM: ​
3:57:48 PM: ❯ Flags
3:57:48 PM: baseRelDir: true
3:57:48 PM: buildId: 6569f449a773ac00094234fb
3:57:48 PM: deployId: 6569f449a773ac00094234fd
3:57:48 PM: ​
3:57:48 PM: ❯ Current directory
3:57:48 PM: /opt/build/repo
3:57:48 PM: ​
3:57:48 PM: ❯ Config file
3:57:48 PM: /opt/build/repo/netlify.toml
3:57:48 PM: ​
3:57:48 PM: ❯ Context
3:57:48 PM: production
3:57:48 PM: ​
3:57:48 PM: ❯ Using Next.js Runtime - v4.41.2
3:57:49 PM: ​
3:57:49 PM: @netlify/plugin-nextjs (onPreBuild event)
3:57:49 PM: ────────────────────────────────────────────────────────────────
3:57:49 PM: ​
3:57:49 PM: Next.js cache restored.
3:57:50 PM: Netlify configuration property “build.environment.NEXT_PRIVATE_TARGET” value changed.
3:57:50 PM: ​
3:57:50 PM: (@netlify/plugin-nextjs onPreBuild completed in 148ms)
3:57:50 PM: ​
3:57:50 PM: build.command from netlify.toml
3:57:50 PM: ────────────────────────────────────────────────────────────────
3:57:50 PM: ​
3:57:50 PM: $ npm run build
3:57:50 PM: > nextjs@4.0.0 build
3:57:50 PM: > next build
3:57:50 PM: info - Loaded env from /opt/build/repo/.env
3:57:50 PM: info - Linting and checking validity of types…
3:57:53 PM: info - Creating an optimized production build…
3:57:54 PM: warn - Found lockfile missing swc dependencies, run next locally to automatically patch
3:58:01 PM: info - Compiled successfully
3:58:01 PM: info - Collecting page data…
3:58:04 PM: info - Generating static pages (0/5)
3:58:05 PM: info - Generating static pages (1/5)
3:58:05 PM: info - Generating static pages (2/5)
3:58:05 PM: info - Generating static pages (3/5)
3:58:05 PM: info - Generating static pages (5/5)
3:58:06 PM: info - Finalizing page optimization…
3:58:06 PM: Route (pages) Size First Load JS
3:58:06 PM: ┌ ○ / (992 ms) 17.8 kB 238 kB
3:58:06 PM: ├ └ css/d8a234b7f9b2f60e.css 846 B
3:58:06 PM: ├ /_app 0 B 109 kB
3:58:06 PM: ├ ○ /404 193 B 109 kB
3:58:06 PM: ├ ○ /login (417 ms) 283 B 109 kB
3:58:06 PM: └ ○ /userAccount (893 ms) 3.08 kB 223 kB
3:58:06 PM: └ css/692ba95bdbd33b41.css 153 B
3:58:06 PM: + First Load JS shared by all 109 kB
3:58:06 PM: ├ chunks/framework-5f4595e5518b5600.js 42.1 kB
3:58:06 PM: ├ chunks/main-47f49556caa66fa6.js 31.9 kB
3:58:06 PM: ├ chunks/pages/_app-a33c4ef190a25558.js 34 kB
3:58:06 PM: ├ chunks/webpack-df4cf1c8d23aa877.js 1.04 kB
3:58:06 PM: └ css/245ae702ad7b7783.css 408 B
3:58:06 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
3:58:06 PM: ​
3:58:06 PM: (build.command completed in 16.5s)
3:58:06 PM: ​
3:58:06 PM: @netlify/plugin-nextjs (onBuild event)
3:58:06 PM: ────────────────────────────────────────────────────────────────
3:58:06 PM: ​
3:58:06 PM: Moving static page files to serve from CDN…
3:58:06 PM: Moved 5 files to CDN
3:58:06 PM: You are not using Netlify Edge Functions for image format detection. Set env var “NEXT_FORCE_EDGE_IMAGES=true” to enable.
3:58:06 PM: Netlify configuration property “redirects” value changed to [
3:58:06 PM: { from: “/next/static/", to: “/static/:splat”, status: 200 },
3:58:06 PM: {
3:58:06 PM: from: "/_next/image
",
3:58:06 PM: query: { url: “:url”, w: “:width”, q: “:quality” },
3:58:06 PM: to: "/ipx/w:width,q
:quality/:url”,
3:58:06 PM: status: 301
3:58:06 PM: },
3:58:06 PM: { from: “/_ipx/", to: “/.netlify/builders/_ipx”, status: 200 },
3:58:06 PM: {
3:58:06 PM: from: "/api/
”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/images/albin.png”,
3:58:06 PM: to: “/images/albin.png”,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/images/alt_logo.png”,
3:58:06 PM: to: “/images/alt_logo.png”,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/images/banner.png”,
3:58:06 PM: to: “/images/banner.png”,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/images/david.png”,
3:58:06 PM: to: “/images/david.png”,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/images/logo.png”,
3:58:06 PM: to: “/images/logo.png”,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/images/mattias.png”,
3:58:06 PM: to: “/images/mattias.png”,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: status: 200
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/",
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: conditions: { Cookie: [Array] },
3:58:06 PM: force: true
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/_next/data/Ktjlv0J3GsBBq8qFfvqXT/index.json”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: force: false
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: force: false
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/_next/data/Ktjlv0J3GsBBq8qFfvqXT/login.json”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: force: false
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/login”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: force: false
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/_next/data/Ktjlv0J3GsBBq8qFfvqXT/userAccount.json”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: force: false
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: “/userAccount”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200,
3:58:06 PM: force: false
3:58:06 PM: },
3:58:06 PM: {
3:58:06 PM: from: "/
”,
3:58:06 PM: to: “/.netlify/functions/___netlify-handler”,
3:58:06 PM: status: 200
3:58:06 PM: }
3:58:06 PM: ].
3:58:06 PM: ​
3:58:06 PM: (@netlify/plugin-nextjs onBuild completed in 162ms)
3:58:06 PM: ​
3:58:06 PM: Functions bundling
3:58:06 PM: ────────────────────────────────────────────────────────────────
3:58:06 PM: ​
3:58:06 PM: The Netlify Functions setting targets a non-existing directory: netlify/functions
3:58:06 PM: ​
3:58:06 PM: Packaging Functions from .netlify/functions-internal directory:
3:58:06 PM: - ___netlify-handler/___netlify-handler.js
3:58:06 PM: - ___netlify-odb-handler/___netlify-odb-handler.js
3:58:06 PM: - _ipx/_ipx.js
3:58:06 PM: ​
3:58:21 PM: ​
3:58:21 PM: (Functions bundling completed in 14.6s)
3:58:21 PM: ​
3:58:21 PM: Edge Functions bundling
3:58:21 PM: ────────────────────────────────────────────────────────────────
3:58:21 PM: ​
3:58:21 PM: ​
3:58:21 PM: (Edge Functions bundling completed in 264ms)
3:58:21 PM: ​
3:58:21 PM: @netlify/plugin-nextjs (onPostBuild event)
3:58:21 PM: ────────────────────────────────────────────────────────────────
3:58:21 PM: ​
3:58:21 PM: Next.js cache saved.
3:58:21 PM: ​
3:58:21 PM: (@netlify/plugin-nextjs onPostBuild completed in 157ms)
3:58:21 PM: ​
3:58:21 PM: Deploy site
3:58:21 PM: ────────────────────────────────────────────────────────────────
3:58:21 PM: ​
3:58:21 PM: Starting to deploy site from “.next”
3:58:21 PM: Calculating files to upload
3:58:22 PM: 6 new files to upload
3:58:22 PM: 2 new functions to upload
3:58:29 PM: Skipping form detection
3:58:29 PM: Post processing - header rules
3:58:29 PM: Post processing done
3:58:29 PM: Section completed: postprocessing
3:58:29 PM: Starting post processing
3:58:29 PM: Post processing - redirect rules
3:58:29 PM: Section completed: deploying
3:58:29 PM: Site deploy was successfully initiated
3:58:29 PM: ​
3:58:29 PM: (Deploy site completed in 7.3s)
3:58:29 PM: ​
3:58:29 PM: Netlify Build Complete
3:58:29 PM: ────────────────────────────────────────────────────────────────
3:58:29 PM: ​
3:58:29 PM: (Netlify Build completed in 40.5s)
3:58:29 PM: Caching artifacts
3:58:29 PM: Started saving node modules
3:58:29 PM: Finished saving node modules
3:58:29 PM: Started saving build plugins
3:58:29 PM: Finished saving build plugins
3:58:29 PM: Started saving corepack cache
3:58:29 PM: Finished saving corepack cache
3:58:29 PM: Started saving pip cache
3:58:29 PM: Finished saving pip cache
3:58:29 PM: Started saving emacs cask dependencies
3:58:29 PM: Finished saving emacs cask dependencies
3:58:29 PM: Started saving maven dependencies
3:58:29 PM: Finished saving maven dependencies
3:58:29 PM: Started saving boot dependencies
3:58:29 PM: Finished saving boot dependencies
3:58:29 PM: Started saving rust rustup cache
3:58:29 PM: Finished saving rust rustup cache
3:58:29 PM: Started saving go dependencies
3:58:29 PM: Finished saving go dependencies
3:58:29 PM: Build script success
3:58:29 PM: Section completed: building
3:58:30 PM: Site is live :sparkles:
3:58:31 PM: Uploading Cache of size 185.0MB
3:58:32 PM: Section completed: cleanup
3:58:32 PM: Finished processing build request in 1m2.21s

(Build version of netlify.toml:

[functions]

[functions._ipx]
node_bundler = “nft”

[functions.___netlify-handler]
included_files = [
“.env”,
“.env.local”,
“.env.production”,
“.env.production.local”,
“./public/locales/",
“./next-i18next.config.js”,
".next/server/
”,
“.next/serverless/",
“.next/.json",
“.next/BUILD_ID”,
".next/static/chunks/webpack-middleware
.js”,
"!.next/server/
/.js.nft.json",
"!.next/server/**/
.map”,
“!/node_modules/@next/swc*//",
"!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/
”,
“!node_modules/next/dist/server/lib/squoosh//*.wasm",
"!node_modules/next/dist/next-server/server/lib/squoosh/
/*.wasm”,
“!node_modules/next/dist/compiled/webpack/bundle4.js”,
“!node_modules/next/dist/compiled/webpack/bundle5.js”,
“node_modules/styled-jsx/style.js”
]
external_node_modules =
node_bundler = “nft”

[functions.___netlify-odb-handler]
included_files = [
“.env”,
“.env.local”,
“.env.production”,
“.env.production.local”,
“./public/locales/",
“./next-i18next.config.js”,
".next/server/
”,
“.next/serverless/",
“.next/.json",
“.next/BUILD_ID”,
".next/static/chunks/webpack-middleware
.js”,
"!.next/server/
/.js.nft.json",
"!.next/server/**/
.map”,
“!/node_modules/@next/swc*//",
"!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/
”,
“!node_modules/next/dist/server/lib/squoosh//*.wasm",
"!node_modules/next/dist/next-server/server/lib/squoosh/
/*.wasm”,
“!node_modules/next/dist/compiled/webpack/bundle4.js”,
“!node_modules/next/dist/compiled/webpack/bundle5.js”,
“node_modules/styled-jsx/style.js”
]
external_node_modules =
node_bundler = “nft”

[functions.“api"]
included_files = [
“.env”,
“.env.local”,
“.env.production”,
“.env.production.local”,
“./public/locales/",
“./next-i18next.config.js”,
".next/server/
”,
“.next/serverless/**”,
".next/
.json”,
“.next/BUILD_ID”,
“.next/static/chunks/webpack-middleware*.js”,
“!.next/server//*.js.nft.json",
"!.next/server/
/.map",
"!**/node_modules/@next/swc
//*",
"!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/
/",
"!node_modules/next/dist/server/lib/squoosh/**/
.wasm”,
“!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm”,
“!node_modules/next/dist/compiled/webpack/bundle4.js”,
“!node_modules/next/dist/compiled/webpack/bundle5.js”,
“node_modules/styled-jsx/style.js”
]
external_node_modules =
node_bundler = “nft”

[build]
command = “npm run build”
publish = “.next”

[build.environment]
NEXT_PRIVATE_TARGET = “server”

[[redirects]]
from = “/_next/static/*”
to = “/static/:splat”
status = 200

[[redirects]]
from = “/next/image*"
to = "/ipx/w:width,q
:quality/:url”
status = 301

[redirects.query]
url = “:url”
w = “:width”
q = “:quality”

[[redirects]]
from = “/_ipx/*”
to = “/.netlify/builders/_ipx”
status = 200

[[redirects]]
from = “/api/*”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/images/albin.png”
to = “/images/albin.png”
status = 200

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/images/alt_logo.png”
to = “/images/alt_logo.png”
status = 200

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/images/banner.png”
to = “/images/banner.png”
status = 200

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/images/david.png”
to = “/images/david.png”
status = 200

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/images/logo.png”
to = “/images/logo.png”
status = 200

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/images/mattias.png”
to = “/images/mattias.png”
status = 200

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/*”
to = “/.netlify/functions/___netlify-handler”
status = 200
force = true

[redirects.conditions]
Cookie = [
“__prerender_bypass”,
“__next_preview_data”
]

[[redirects]]
from = “/_next/data/Ktjlv0J3GsBBq8qFfvqXT/index.json”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/_next/data/Ktjlv0J3GsBBq8qFfvqXT/login.json”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/login”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/_next/data/Ktjlv0J3GsBBq8qFfvqXT/userAccount.json”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/userAccount”
to = “/.netlify/functions/___netlify-handler”
status = 200

[[redirects]]
from = “/*”
to = “/.netlify/functions/___netlify-handler”
status = 200

[context]

[context.production]

[context.production.environment]
NEXT_PRIVATE_TARGET = "server"

[context.production.functions]

  [context.production.functions._ipx]
  node_bundler = "nft"

  [context.production.functions.___netlify-handler]
  included_files = [
    ".env",
    ".env.local",
    ".env.production",
    ".env.production.local",
    "./public/locales/**",
    "./next-i18next.config.js",
    ".next/server/**",
    ".next/serverless/**",
    ".next/*.json",
    ".next/BUILD_ID",
    ".next/static/chunks/webpack-middleware*.js",
    "!.next/server/**/*.js.nft.json",
    "!.next/server/**/*.map",
    "!**/node_modules/@next/swc*/**/*",
    "!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*",
    "!node_modules/next/dist/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/compiled/webpack/bundle4.js",
    "!node_modules/next/dist/compiled/webpack/bundle5.js",
    "node_modules/styled-jsx/style.js"
  ]
  external_node_modules = []
  node_bundler = "nft"

  [context.production.functions.___netlify-odb-handler]
  included_files = [
    ".env",
    ".env.local",
    ".env.production",
    ".env.production.local",
    "./public/locales/**",
    "./next-i18next.config.js",
    ".next/server/**",
    ".next/serverless/**",
    ".next/*.json",
    ".next/BUILD_ID",
    ".next/static/chunks/webpack-middleware*.js",
    "!.next/server/**/*.js.nft.json",
    "!.next/server/**/*.map",
    "!**/node_modules/@next/swc*/**/*",
    "!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*",
    "!node_modules/next/dist/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/compiled/webpack/bundle4.js",
    "!node_modules/next/dist/compiled/webpack/bundle5.js",
    "node_modules/styled-jsx/style.js"
  ]
  external_node_modules = []
  node_bundler = "nft"

  [context.production.functions."_api_*"]
  included_files = [
    ".env",
    ".env.local",
    ".env.production",
    ".env.production.local",
    "./public/locales/**",
    "./next-i18next.config.js",
    ".next/server/**",
    ".next/serverless/**",
    ".next/*.json",
    ".next/BUILD_ID",
    ".next/static/chunks/webpack-middleware*.js",
    "!.next/server/**/*.js.nft.json",
    "!.next/server/**/*.map",
    "!**/node_modules/@next/swc*/**/*",
    "!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*",
    "!node_modules/next/dist/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/compiled/webpack/bundle4.js",
    "!node_modules/next/dist/compiled/webpack/bundle5.js",
    "node_modules/styled-jsx/style.js"
  ]
  external_node_modules = []
  node_bundler = "nft"

[context.production.build]

  [context.production.build.environment]
  NEXT_PRIVATE_TARGET = "server"

[context.master]

[context.master.environment]
NEXT_PRIVATE_TARGET = "server"

[context.master.functions]

  [context.master.functions._ipx]
  node_bundler = "nft"

  [context.master.functions.___netlify-handler]
  included_files = [
    ".env",
    ".env.local",
    ".env.production",
    ".env.production.local",
    "./public/locales/**",
    "./next-i18next.config.js",
    ".next/server/**",
    ".next/serverless/**",
    ".next/*.json",
    ".next/BUILD_ID",
    ".next/static/chunks/webpack-middleware*.js",
    "!.next/server/**/*.js.nft.json",
    "!.next/server/**/*.map",
    "!**/node_modules/@next/swc*/**/*",
    "!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*",
    "!node_modules/next/dist/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/compiled/webpack/bundle4.js",
    "!node_modules/next/dist/compiled/webpack/bundle5.js",
    "node_modules/styled-jsx/style.js"
  ]
  external_node_modules = []
  node_bundler = "nft"

  [context.master.functions.___netlify-odb-handler]
  included_files = [
    ".env",
    ".env.local",
    ".env.production",
    ".env.production.local",
    "./public/locales/**",
    "./next-i18next.config.js",
    ".next/server/**",
    ".next/serverless/**",
    ".next/*.json",
    ".next/BUILD_ID",
    ".next/static/chunks/webpack-middleware*.js",
    "!.next/server/**/*.js.nft.json",
    "!.next/server/**/*.map",
    "!**/node_modules/@next/swc*/**/*",
    "!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*",
    "!node_modules/next/dist/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/compiled/webpack/bundle4.js",
    "!node_modules/next/dist/compiled/webpack/bundle5.js",
    "node_modules/styled-jsx/style.js"
  ]
  external_node_modules = []
  node_bundler = "nft"

  [context.master.functions."_api_*"]
  included_files = [
    ".env",
    ".env.local",
    ".env.production",
    ".env.production.local",
    "./public/locales/**",
    "./next-i18next.config.js",
    ".next/server/**",
    ".next/serverless/**",
    ".next/*.json",
    ".next/BUILD_ID",
    ".next/static/chunks/webpack-middleware*.js",
    "!.next/server/**/*.js.nft.json",
    "!.next/server/**/*.map",
    "!**/node_modules/@next/swc*/**/*",
    "!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*",
    "!node_modules/next/dist/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm",
    "!node_modules/next/dist/compiled/webpack/bundle4.js",
    "!node_modules/next/dist/compiled/webpack/bundle5.js",
    "node_modules/styled-jsx/style.js"
  ]
  external_node_modules = []
  node_bundler = "nft"

[context.master.build]

  [context.master.build.environment]
  NEXT_PRIVATE_TARGET = "server")

Build settings:

Have you checked this?