Next.js Discord

Discord Forum

Where do console.log()s in getServerSideProps() go?

Answered
Sun bear posted this in #help-forum
Open in Discord
Avatar
Sun bearOP
TL;DR:
console.logs() in getServerSideProps() do not show on either the browser console or the terminal where I run "npm run dev". So where do they go?

My current understanding of what is happening:
Let's say I'm running a next.js app locally. So I run "npm run dev", a server opens up on localhost:3000. When, on my browser, I access "localhost:3000/", the server looks for my index.js page, runs its corresponding getServerSideProps() function, creates the HTML, then serves the browser some HTML and JS for that page. The getServerSideProps() is never given to the browser, so any console.log()s present there are not shown on the browser console. However, they don't show up in my terminal either, which I don't understand.
Answered by joulev
the console.logs should show up in terminal
Image
View full answer

4 Replies

Avatar
joulev
the console.logs should show up in terminal
Image
Answer
Avatar
Sun bearOP
Oh wow you're right, I wasn't seeing them and assumed they weren't there. Thank you very much!
Avatar
Greater Flamingo
I have same issue, didi it resolved for you suddenly?
Avatar
Greater Flamingo
mine resolved, I was returning early before logging line inside getServerSideProps..