Next.js Discord

Discord Forum

Why i'm receiving this message: "Self is not defined"? :thinq:

Answered
Fencher posted this in #help-forum
Open in Discord
Hello, i started to receive this message "Self is not defined" and i don't know how to solve, in local development this don't affect me "apparently" but when i make a "run build" all my routes are broken... i received the same message for all routes in my code...

For the example i'm using dashboard route...

log on run build:
Error occurred prerendering page "/dashboard". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: self is not defined
    at 72090 (...app\.next\server\chunks\82.js:181:15339)  
    at t (...app\.next\server\webpack-runtime.js:1:142)      
    at 37881 (...app\.next\server\chunks\225.js:8:38653)   
    at t (...app\.next\server\webpack-runtime.js:1:142)    
    at 48203 (...app\.next\server\chunks\225.js:8:29532)   
    at t (...app\.next\server\webpack-runtime.js:1:142)    
    at 28077 (...app\.next\server\chunks\507.js:1:11101)   
    at t (...app\.next\server\webpack-runtime.js:1:142)    
    at 2507 (...app\.next\server\chunks\507.js:1:124)      
    at t (...app\.next\server\webpack-runtime.js:1:142)    
...
> Export encountered errors on following paths:
        ...
        /(webApp)/dashboard/page: /dashboard
        ...
`

Code from this page:
"use client"; // i try without this to.

import { Card } from "antd";
import Image from "next/image";

export default function Dashboard() {
  return (
    <Card className="h-full flex items-center justify-center">
      <Image alt="logo" src="/images/logoBlue.png" width={300} height={200} />
    </Card>
  );
}

I already read the documentation appointed on the log but does not helped me...
Can anybody help me to understand?
Answered by Fencher
i solved, i'm using a notification lib that cause all the problem
View full answer

1 Reply

i solved, i'm using a notification lib that cause all the problem
Answer