Search code examples
javascriptreactjsnext.jshash

What is a digest property?


I am new to using NextJS and am trying to get my first project up in production. But I am seeing this error:

Application error: a client-side exception has occurred (see the browser console for more information).
Digest: 4266806755

It seems to me like this digest property should be able to be inspected in some way, but I cannot find information on how to do this.

What is this digest property and how would I go about using it to troubleshoot my issue?

Of course it works perfectly well when testing locally using my localhost. But when I am running my code in production I saw the above error. Upon inspection of the container running my code, I see

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at parseJSONFromBytes (node:internal/deps/undici/undici:6571:19)
    at successSteps (node:internal/deps/undici/undici:6545:27)
    at node:internal/deps/undici/undici:1211:60
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at parseJSONFromBytes (node:internal/deps/undici/undici:6571:19)
    at successSteps (node:internal/deps/undici/undici:6545:27)
    at node:internal/deps/undici/undici:1211:60
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: '4266806755'
}

I am expecting to see no errors. But since I see this one, I would like to be able to inspect the error.


Solution

  • Here is your answer in the NextJS docs. Other than that, I don't know what or where the problem is in your code. Time to debug :)

    https://nextjs.org/docs/app/building-your-application/routing/error-handling#handling-server-errors

    But in case you don't understand, you need to go through your server-side logs, and match the digest hash that is in the error message with the same hash in the logs, to find where the error happened at exactly.