Deploying Lift-Off V Client on Railway Issue: Shows blank page with "Not Found" page title

Hi, I’m trying to deploy the odyssey lift off part 5 client on Railway and it successfully deployed, but the page just says “Not Found” and shows a blank page. The browser console keeps trying to fetch, returning a 404 error each time, with intermittent “Not Authorized” messages. I’m assuming this is probably a cors issue, from research. I’ve already tried adding a cors variable to my ApolloServer instance in my server code, as well as adding require(‘dotenv’).config() and require(‘cors’). Any help is appreciated, thanks!

Here are my repos:

Hi,

Not sure if we have the same problem, but my logs in Railway showed
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached
for every package.

This error message typically means that the operating system’s limit on the number of files that can be watched by a process has been reached. So I looked at how to stop files being watched.

You can exclude files from the watcher by using the CHOKIDAR_USEPOLLING and CHOKIDAR_INTERVAL environment variables.

To set the CHOKIDAR_USEPOLLING and CHOKIDAR_INTERVAL environment variables, in Railway do the following:

  1. Go to your Railway project dashboard.
  2. Click on the “Settings” tab.
  3. Click on the “Environment Variables” section.
  4. Click the “Add Environment Variable” button.
  5. Enter CHOKIDAR_USEPOLLING as the name of the environment variable.
  6. Set the value to true.
  7. Click the “Add Environment Variable” button again.
  8. Enter CHOKIDAR_INTERVAL as the name of the environment variable.
  9. Set the value to the desired polling interval in milliseconds (e.g. 1000 for 1 second).
  10. Click the “Save Changes” button.

The client restarted the first time with a heap error the first time. But on the second deploy it worked.

I didn’t check the developer tool like you did in your example, so I’m not sure if its the same. I hope this helped!

1 Like

Hey @kevin9gao! Sorry for the delay in response, hoping we can troubleshoot this together!

I was able to deploy the server successfully (https://odyssey-lift-off-part5-server-1-production.up.railway.app/) with only the PORT changes. Apollo Server v3’s default CORS behavior enables any website on the internet to tell a user’s browser to connect to your server. (Though we do recommend changing it to be more secure and specify the allowed origins, for the purposes of this tutorial, we can leave it as-is).

On the client end, @sophiemcgarity mentioned a heap error - which was what I was running into. To fix this, I scrolled over to Settings → Deploy → Start command and pasted this command in:

react-scripts --max_old_space_size=4096 start

You can also make that change in the package.json file itself, replacing the start script. Here’s the Stack Overflow post as a reference.

Hope that helps, let me know if it fixes your client deploy or if we need to troubleshoot further!

Follow-up! We’ve been working on updating this course (turning the deployment sections into a separate side quest) and I believe this is the better solution.

Update the start command in Railway to be:

npm i serve && serve -s build

This overrides the start script set in our codebase (react-scripts start) and tells Railway to instead use the serve npm package to serve up the static files in our production build folder. This should take care of those memory limits! Let me know if that works!