Where do console.log()s in getServerSideProps() go?
Answered
Sun bear posted this in #help-forum
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.
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.
4 Replies
Answer
Sun bearOP
Oh wow you're right, I wasn't seeing them and assumed they weren't there. Thank you very much!
Greater Flamingo
I have same issue, didi it resolved for you suddenly?
Greater Flamingo
mine resolved, I was returning early before logging line inside getServerSideProps..