All api calls in frontend return html saying "enable javascript"

ProjectId: 30296f5a-7960-4804-b75a-025dd4f6760d Hi, I 'm working on a react project that I have deployed. Right now I have one railway deployment for the backend, and anther for the frontend. All of the calls to the backend seem to work, but calls to the frontend seem to be returning html that looks like: <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.22c2078d.js"></script><link href="/static/css/main.1ef3a49a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>% I've already checked that I have javascript enabled in the browser, so I'm wondering if there is a setting that needs to happen inside railway?
10 Replies
Percy
Percy7mo ago
Project ID: 30296f5a-7960-4804-b75a-025dd4f6760d
Brody
Brody7mo ago
this is a client side rendered app, requests to the frontend need to be done by the browser, the browser will then run the JavaScript and your frontend will render
ari.pickar
ari.pickar7mo ago
Gotcha, does that mean changing the url i'm visiting? Or something else? Currently, I'm going to parlaydashboard-production.up.railway.app
Brody
Brody7mo ago
when I visit that address I see your web page and a message about running in production? are you perhaps trying to make api calls to the frontend address instead of specifying the backend address when making api calls? check in the dev tools for your browser, you will get better insights of the domains involved in the network tab
ari.pickar
ari.pickar7mo ago
So going to the base url works but going to parlaydashboard-production.up.railway.app/users or any other url in the path seems to be making calls to the frontend, but I have axios set up to be making calls to the other service I have deployed like this. const baseURL = process.env.NODE_ENV === 'development' ? 'http://localhost:8000' : "http://parlaybackend.railway.internal" const axiosInstance = axios.create({ baseURL: baseURL }); Since the NODE_ENV is "production", shouldn't it be making calls to the internal backend url? Wait I just realized I had overridden that import somewhere, thanks for helping me debug
Brody
Brody7mo ago
so all solved?
ari.pickar
ari.pickar7mo ago
Actually not quite. It seems like trying to call the internal network over http http://parlaybackend.railway.internal is being prevented due to no certificate. Do I need an https certificate for my backend for requests inside railway? Or is that something that I should use the public facing url? @Brody
Brody
Brody7mo ago
this is a client side app, you would need to call the public backend domain
ari.pickar
ari.pickar7mo ago
Ok, got it. Thanks!
Brody
Brody7mo ago
no problem!
Want results from more Discord servers?
Add your server
More Posts