Next.js Discord

Discord Forum

Error: Connection Closed

Answered
Abhii posted this in #help-forum
Open in Discord
Hello, I have been building this app it’s working fine on local , it breaks in production on routes like products/[id] and categories/[slug]. In console its shows
Error : Connection closed

https://store-thing.vercel.app/categories
Answered by B33fb0n3
then it looks like the api that you are using is broken (or at least serverless hosted) and then your connection is broken, because the server was shut downed. If I would be you, I would create a constants.ts file that contains some products and then use that. It's much more reliable (or of course your own database)
View full answer

26 Replies

@Abhii solved?
I have removed the code where database being used and crashing has stopped, however its still crashing at some pages. I'm still working on those pages to identify whats causing this.
Thank you it was great help , can you please tell how can i fix this as im using mongodb.
the last one , im not getting any error on local so its hard to find whats happening here.
https://github.com/Abhii5496/store-thing , repo if you want to take a look .
yes
when i hard refresh it works
when does this error pop up? When you click something? Hover something? When you interact with something? ...
when i navigate to any product detail page (/products/1)
@Abhii when i navigate to any product detail page (/products/1)
can you refresh the current page (should work, as you said) and directly navigate to any other product detail page?
yes
well now im getting this
fakestore api is down , i'll try it later
@Abhii fakestore api is down , i'll try it later
no, it's up
@Abhii well now im getting this
ok its working now
its working fine
@Abhii its working fine
but when you refresh the page, wait around 15 seconds and then navigate, it shows the error?
thats right
no , after removing these two it works well.
@Abhii no , after removing these two it works well.
then it looks like the api that you are using is broken (or at least serverless hosted) and then your connection is broken, because the server was shut downed. If I would be you, I would create a constants.ts file that contains some products and then use that. It's much more reliable (or of course your own database)
Answer
@Abhii solved?
sure thing