Application Error: Server-Side Exception on Localhost When Updating Data Structure
Answered
American posted this in #help-forum
AmericanOP
Hey team/developers,
I encountered an application error while loading localhost. Here are the details:
Message: Application error: a server-side exception has occurred while loading localhost (see the server logs for more information).
Digest: 965645458
Key Observations:
The same development branch is hosted on the dev environment and works fine there .
The issue only occurs locally when I make a specific change:
I’m updating the data structure of one of my collections by changing the value of a field from "daily" to "priority".
The error does not occur on the dev environment, even after deploying the changes.
I encountered an application error while loading localhost. Here are the details:
Message: Application error: a server-side exception has occurred while loading localhost (see the server logs for more information).
Digest: 965645458
Key Observations:
The same development branch is hosted on the dev environment and works fine there .
The issue only occurs locally when I make a specific change:
I’m updating the data structure of one of my collections by changing the value of a field from "daily" to "priority".
The error does not occur on the dev environment, even after deploying the changes.
Answered by American
I got it now. I am using my helper component as client component but there is nowhere it is leveraging the client behaviour. I removed the "use client" from the helper component and it resolves everything.
22 Replies
Nebelung
Can you share an image?
Also, is it open source?
AmericanOP
No, it is not open source.
can you click the warning
AmericanOP
In the terminal?
there is a link
AmericanOP
It is taking me to next-auth page
yes, you should see a fix there
AmericanOP
But it is not related to auth and the application is working fine currently.
can you send your frontend code
AmericanOP
The error I am getting is when I am changing my data structure else the application is working fine.
Here?
Yes, use codeblocks and send code of relevant parts
AmericanOP
import ConstituencyPage from "@/app/dashboard/constituency/constituency-page";
import { getCategorySetup } from "@/app/lib/data";
import { supportedLanguagesCookieCheck } from "@/app/lib/utils";
import { cookies } from "next/headers";
import { getServerSession } from "next-auth";
import { options } from "@/app/api/auth/[...nextauth]/options";
import { redirect } from "next/navigation";
import {
getMostRecentVotingResult,
hasUserVotedInCategory,
} from "@/app/lib/data";
export default async function Page() {
const cookieStore = await cookies();
const language = supportedLanguagesCookieCheck(cookieStore)
? cookieStore.get("language")?.value
: "en";
const session = await getServerSession(options);
if (!session) {
redirect("/login");
}
const constituencyPageSetup = await getCategorySetup(
"constituency",
session.user.constituencyId
);
const [lastestResult, voteDetails] = await Promise.all([
getMostRecentVotingResult("constituency", session.user.constituencyId),
hasUserVotedInCategory(session.user?.id, constituencyPageSetup),
]);
return (
<ConstituencyPage
data={constituencyPageSetup}
language={language}
lastestResult={lastestResult}
voteDetails={voteDetails}
/>
);
}
I can see the data when i am logging in page.jsx but for ConstituencyPage component.
console.log is not even rendering for the first line.
console.log is not even rendering for the first line.
can you send that component
AmericanOP
Can you send as code block or gist link
AmericanOP
const ConstituencyPage = ({ data, language, lastestResult, voteDetails }) => {
const { category, issueList } = data;
const startDate = dateISOToLocal(issueList[0]?.startDate);
const endDate = dateISOToLocal(issueList[0]?.endDate);
const phaseEndDate = dateISOToLocal(issueList[0]?.phaseEndDate);
return (
<Box>
{/* Representative and Recent Voting Result Section */}
<RepresentativeAndResult
category={category}
language={language}
lastestResult={lastestResult}
/>
{/* Voting Phase Information */}
<Box mb={3}>
<Typography variant="body" gutterBottom>
Circuit End Date:
{phaseEndDate ?? "-"}
</Typography>
<Typography variant="h5" gutterBottom>
Voting Phase:
{category.votingPhase === "priority"
? "Priority Voting"
: "Daily Voting"}
</Typography>
<Typography variant="body1" color="text.secondary" gutterBottom>
Voting Ends: {startDate ?? "-"} to {endDate ?? "-"}
</Typography>
</Box>
<Divider sx={{ my: 2 }} />
</Box>
);
};
AmericanOP
I got it now. I am using my helper component as client component but there is nowhere it is leveraging the client behaviour. I removed the "use client" from the helper component and it resolves everything.
Answer