FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #26698
Replies: 2 comments
-
I had the same bug and after hours of digging found the error in my code. It was an infinite loop caused by a mistake in the JWT tokens and authentication flow, where a condition triggered the token function to repeat endlessly, eventually consuming all the memory. That is why increasing memory also didn't work. The cause might be different for you, but just a tip: check your code for infinite loops - especially in the next-auth options file since you are using next-auth. |
Beta Was this translation helpful? Give feedback.
-
Yo, I’ve been there — took a short break, came back, and boom... In my case, the issue turned out to be something totally not obvious: What happened was: So if you're using NextAuth (which I see you are), I’d strongly suggest:
Temporary hack: try commenting out your custom callbacks and slowly reintroducing them to isolate the cause. Hope this saves you hours of hair-pulling like it did for me. Let me know if you want help checking the exact file. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I keep getting this error with npm run dev. I am pulling my hair out, there is no solution that has worked thus far. Oddly, I went away for 4 days (everything was working) and then came back to this. Is there any solution? I am using the latest version of next, node, and every other dependency.
Here is my package.json:
Beta Was this translation helpful? Give feedback.
All reactions