Site name: www.worksidehost.com
My issue is getting data from my Google Cloud database. First of all, everything works fine on my development machine. When I log in, I have this code snippet to validate the user:
const fetchString = `/api/user/${userName}?password=${password}`;
const response = await axios.get(fetchString);
I am able to connect to the database, get the response and validate the user and permissions. This works on both my development machine and on the deployed website.
When attempting to grab a list of the projects in my database I have this code snippet:
const fetchString = "/api/project";
const response = await axios.get(fetchString);
window.alert(`Response... ${JSON.stringify(response)}`);
This works on my development machine yet fails on the deployed website.
This is the resulting output.
The piece that concerns me is the “You need to enable JavaScript to run this app.” I have tried both “yarn build” and “npm build”. Please advise.
@suntan-superman There may be several things wrong.
This is easily explained.
It’s the source of your /index.html
file:
You’ve probably implemented this rewrite:
/* /index.html 200
So any request that would normally result in a 404
is instead returned that.
Which you can see demonstrated here:
https://worksidehost.com/this/url/does/not/exist
So you should debug from the perspective that whatever route you requested doesn’t actually exist.
This might be due to how you’ve implemented it.
For example I cannot tell if your axios code is using serverless functions.
Nathan,
This is my entire index.html file:
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Workside</title>
You need to enable JavaScript to run this app.
@suntan-superman I have no idea why you’re providing this.
The source code for your index.html
file is irrelevant.
This is what I am referring to:
Nathan,
I am trying to provide you with ANYTHING that might assist in determining why database access works fine from mobile devices, while running my app from my local development machine and from my web interface yet fails when hosted on Netlify.
You mentioned this:
You’ve probably implemented this rewrite:
/* /index.html 200
So any request that would normally result in a 404
is instead returned that.
Where would I have implemented the rewrite that you mentioned?
I’ve responded in the helpdesk.