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
Percy13mo ago
Project ID: N/A
angelplusultra
angelplusultraOP13mo ago
n/a
Fragly
Fragly13mo ago
App Sleeping isn't enabled right?
angelplusultra
angelplusultraOP13mo ago
I don't see that setting in the server configuration settings, do you know where I could find that?
Brody
Brody13mo 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
angelplusultra
angelplusultraOP13mo 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
Brody13mo 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
angelplusultra
angelplusultraOP13mo 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
Brody13mo ago
no this is backed related, are there errors in the backend? and what kind of Backend is it?
angelplusultra
angelplusultraOP13mo ago
Strapi CMS w/ NodeJS
Brody
Brody13mo ago
send your database.js
angelplusultra
angelplusultraOP13mo 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
Brody13mo ago
angelplusultra
angelplusultraOP13mo 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.
angelplusultra
angelplusultraOP13mo ago
here is my database.js revise the pool field?
Brody
Brody13mo ago
set pool.min to 0 as shown by the database.js file I linked
angelplusultra
angelplusultraOP13mo ago
I will try that out, thank you for the suggestion
Brody
Brody13mo ago
if done right, this will work, it's mentioned in strapis docs
Brody
Brody13mo ago
in fact I'm confident enough to do this
Want results from more Discord servers?
Add your server