TypeError: Cannot read properties of undefined reading:

site: Florence Barbell Studio or https://florencebarbellstudio.netlify.app/it
Error is presenting in functions log.
error:
Oct 8, 05:05:47 PM: ea7a5574 ERROR TypeError: Cannot read properties of undefined (reading 'tabs')Oct 8, 05:05:47 PM: ea7a5574 ERROR at Q (/var/task/.next/server/app/[locale]/page.js:1:128626) {Oct 8, 05:05:47 PM: ea7a5574 ERROR digest: '204379464'Oct 8, 05:05:47 PM: ea7a5574 ERROR }Oct 8, 05:05:47 PM: ea7a5574 ERROR TypeError: Cannot read properties of undefined (reading 'metaHtml')Oct 8, 05:05:47 PM: ea7a5574 ERROR at Module.I (/var/task/.next/server/chunks/172.js:1:12693)Oct 8, 05:05:47 PM: ea7a5574 ERROR at /var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:227710Oct 8, 05:05:47 PM: ea7a5574 ERROR at /var/task/node_modules/next/dist/server/lib/trace/tracer.js:140:36Oct 8, 05:05:47 PM: ea7a5574 ERROR at NoopContextManager.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)Oct 8, 05:05:47 PM: ea7a5574 ERROR at ContextAPI.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)Oct 8, 05:05:47 PM: ea7a5574 ERROR at NoopTracer.startActiveSpan (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18093)Oct 8, 05:05:47 PM: ea7a5574 ERROR at ProxyTracer.startActiveSpan (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18854)Oct 8, 05:05:47 PM: ea7a5574 ERROR at /var/task/node_modules/next/dist/server/lib/trace/tracer.js:122:103Oct 8, 05:05:47 PM: ea7a5574 ERROR at NoopContextManager.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)Oct 8, 05:05:47 PM: ea7a5574 ERROR at ContextAPI.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518) {Oct 8, 05:05:47 PM: ea7a5574 ERROR digest: '4285506614'Oct 8, 05:05:47 PM: ea7a5574 ERROR }

If i browse the website i get no error, in any page. I wait some hours and when i check the logs i found a lot of errors like this one.

Local build is ok, no error in console nor in the server terminal.

The " TypeError: Cannot read properties of undefined (reading ‘tabs’" it makes no sense because it should be occouring in every page access.
Thanks for any help.

i tried to change the imports of json files in the page component:
from
import data from ‘…’
to
const fileHome = await fs.readFile(
process.cwd() + “/…”,
“utf8”
);
but no luck:

Oct 12, 10:16:22 AM: 8f9e62bd ERROR [Error: ENOENT: no such file or directory, open ‘/var/task/public/data/metadata/meta-home.json’] {
errno: -2,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘/var/task/public/data/metadata/meta-home.json’,
digest: ‘263991367’
}

but the file is in the very same directory

How to Include Files in Netlify Serverless Functions

i thanks for the answer.
I read the article,
netlify.toml

[functions]
  included_files = ["public/data/**"]

page.tsx

 const homeData = require("../../../public/data/home.json");

as suggested but nothing change:

Oct 14, 01:54:26 PM: 0cc65b3c   digest: '2040631856'Oct 14, 01:54:26 PM: 0cc65b3c }Oct 14, 01:54:26 PM: 0cc65b3c ERROR  TypeError: Cannot read properties of undefined (reading 'tabs')Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at U (/var/task/.next/server/app/[locale]/page.js:1:128555)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at eh (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134786)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at e (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:137671)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at ek (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:138145)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at Array.toJSON (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135755)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at stringify (<anonymous>)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at eP (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142219)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at eE (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142698)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at Timeout._onTimeout (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135475)Oct 14, 01:54:26 PM: 0cc65b3c ERROR      at listOnTimeout (node:internal/timers:569:17) {Oct 14, 01:54:26 PM: 0cc65b3c ERROR    digest: '1918073705'Oct 14, 01:54:26 PM: 0cc65b3c ERROR  }

the strange thing is that i have multiple json data imported. but only those receive the problem

Hi @designtoy,

Could the issue be that you added const homeData = require("../../../public/data/home.json"); to a page.tsx file while the error is showing:

Oct 8, 05:05:47 PM: ea7a5574 ERROR at Q (/var/task/.next/server/app/[locale]/page.js:1:128626) which is a page.js file (which is page.js)?

Could you add a console.log to ensure that the homeData object is being includes the expected properties and is properly formatted JSON?

Ok, thanks to all. I found that the error is in the Locale variable by next-intl. I need to further investigate, but seems that this variable is not always available in all the requests. I think next-intl is not so “robust” as project… the strange is that the error was only in the functions consolle of netlify dash