vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.23k stars 26.89k forks source link

How to make nextjs build error log more sense? #71797

Closed andreymaklakov closed 2 hours ago

andreymaklakov commented 2 hours ago

Link to the code that reproduces this issue

any build

To Reproduce

any build

Current vs. Expected behavior

Is there an option in nextjs to make build logs more understandable?

If build has an error, log shows chunk path, but I like to see exact file path, where error occured and line number. If there is error because of request error I'd like to see exact request url and response error code and message.

Is it possible to make logs with such information?

ReferenceError: window is not defined
    at supportUrl (/app/.next/server/chunks/5449.js:153:45)
    at new BillingAbstract (/app/.next/server/chunks/8753.js:222:89)
    at new ProfileBilling (/app/.next/server/chunks/5506.js:165:1)
    at d (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:320)
    at bb (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
    at a.b.render (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
    at a.b.read (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
    at Object.exports.renderToString (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
    at Object.renderPage (/app/node_modules/next/dist/server/render.js:680:46)
    at Object.defaultGetInitialProps (/app/node_modules/next/dist/server/render.js:350:67)

TypeError: Cannot destructure property 'data' of '(intermediate value)' as it is undefined.
    at /app/.next/server/chunks/2996.js:5148:17
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getStaticProps$1 (/app/.next/server/pages/legal/[key]/[documentId]/archive.js:66:21)
    at async renderToHTML (/app/node_modules/next/dist/server/render.js:386:20)
    at async /app/node_modules/next/dist/export/worker.js:304:36
    at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:79:20)
Error occurred prerendering page "/ru/legal/4game/2944/archive". Read more: https://nextjs.org/docs/messages/prerender-error

Warning: data for page "/legal/[key]/[documentId]/archive/[versionId]" (path "/legal/4game/33/archive/5575/") is 208 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
See more info here: https://nextjs.org/docs/messages/large-page-data
getStaticProps error:  {
  description: 'No data for key: Innova.Content.Application.Queries.Pages.GetPageQuery',
  code: 'content.datanotfound'
}
getStaticProps error:  {
  description: 'No data for key: Innova.Content.Application.Queries.Pages.GetPageQuery',
  code: 'content.datanotfound'
}

Provide environment information

mac os

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

github-actions[bot] commented 2 hours ago

We could not detect a valid reproduction link. Make sure to follow the bug report template carefully.

Why was this issue closed?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We need a link to a public GitHub repository (template for App Router, template for Pages Router), but you can also use these templates: CodeSandbox: App Router or CodeSandbox: Pages Router.

The bug template that you filled out has a section called "Link to the code that reproduces this issue", which is where you should provide the link to the reproduction.

What should I do?

Depending on the reason the issue was closed, you can do the following:

In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

My repository is private and cannot make it public

In most cases, a private repo will not be a sufficient minimal reproduction, as this codebase might contain a lot of unrelated parts that would make our investigation take longer. Please do not make it public. Instead, create a new repository using the templates above, adding the relevant code to reproduce the issue. Common things to look out for:

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps by opening a new issue.

I think my reproduction is good enough, why aren't you looking into it quickly?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources