R
Railway7mo ago
mac

Cold Start Issue

Hello, I recently deployed a NodeJS server on Railway that acts as the backend to a React App that I'm hosting on Vercel, but I'm facing an issue of the server going to sleep after enough time passes by with inactivity. How can I fix this? The server needs to be ready to serve content at all times.
20 Replies
Percy
Percy7mo ago
Project ID: N/A
mac
mac7mo ago
n/a
Fragly
Fragly7mo ago
App Sleeping isn't enabled right?
mac
mac7mo ago
I don't see that setting in the server configuration settings, do you know where I could find that?
Brody
Brody7mo ago
it's in the service settings, it's off by default and if you don't know about it then it's still off when it's off, there is no cold starts
mac
mac7mo ago
Its not in the settings, i'm looking at the docs exactly where the screenshot says it should be (right next to the healthcheck settings) and its not there. If theres no cold starts then does anyone here have an idea why this could be happening with my application?
Brody
Brody7mo ago
my first thoughts are after a while the idle timeout for your database passes and then on the next request your app has to reconnect to the database it's not in the settings because it's a beta feature, but like I said it's off by default
mac
mac7mo ago
Is it something I can fix within the frontend? It's hard to debug because once the server is up and running the bug wont reproduce for another couple hours or so and the timeout occurs again.
Brody
Brody7mo ago
no this is backed related, are there errors in the backend? and what kind of Backend is it?
mac
mac7mo ago
Strapi CMS w/ NodeJS
Brody
Brody7mo ago
send your database.js
mac
mac7mo ago
Connection Error: Connection ended unexpectedly This is in my logs when I made the request and it failed the initial request, everything after is 200
Brody
Brody7mo ago
mac
mac7mo ago
GitHub
calm-shrub-website/server/config/database.js at main · angelplusult...
a website for the artist, Calm Shrub. Contribute to angelplusultra/calm-shrub-website development by creating an account on GitHub.
mac
mac7mo ago
here is my database.js revise the pool field?
Brody
Brody7mo ago
set pool.min to 0 as shown by the database.js file I linked
mac
mac7mo ago
I will try that out, thank you for the suggestion
Brody
Brody7mo ago
if done right, this will work, it's mentioned in strapis docs
Brody
Brody7mo ago
in fact I'm confident enough to do this