---
title: "Discussion on \"Unexpected Token Error: Handling 404 Response in NextJS Application\" | Hashnode"
description: "Discussion on \"Unexpected Token Error: Handling 404 Response in NextJS Application\". const page = async() => {\nconst session = await getServerSession(authOptions)\nif(!session){\n    redirect(\"/\")\n}\nconst response = await checkPdf()\nreturn (\n<div>\n   <ChatComponent name={session.user.name} heading={response===true?true:false}/>\n</div>\n..."
url: "https://hashnode.com/posts/unexpected-token-error-handling-404-response-in-nextjs-application/663c6cfd62b6a3ab22144c8e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Unexpected Token Error: Handling 404 Response in NextJS Application](https://nextjss.hashnode.dev/unexpected-token-error-handling-404-response-in-nextjs-application?utm_source=hashnode&utm_medium=feed)

const page = async() => { const session = await getServerSession(authOptions) if(!session){ redirect("/") } const response = await checkPdf() return ( <div> <ChatComponent name={session.user.name} heading={response===true?true:false}/> </div> ...

May 9, 2024 · 1 min read · nextjss.hashnode.dev  
Read the article

-   [#next-js](https://hashnode.com/tag/next-js)

## Written by

[ajit gupta](https://hashnode.com/@ajitgupta50828)

@ajitgupta50828 · India

  
[View profile](https://hashnode.com/@ajitgupta50828)

developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
