#Cannot GET files_on_server
32 messages · Page 1 of 1 (latest)
the 404 is saying that it cannot reach the server. But, the other functions work. For example:
fetch('http://localhost:3000/request_saved_combos')
const contents = fs.readFileSync('saved_prompt_and_response/data.jsonl', 'utf8');
res.send({ contents });
});```
So the server is there and the fetch server address matches.
Looking at the URL in the fetch:
```fetch('http://localhost:3000/files_on_server')```
this matches the server:
app.get('/files_on_server')
In my opinion there are several possible reasons for this error:
The server may not be running on the local machine. Make sure that the server is running and that it is listening on the correct port (in this case, 3000).
The server may not have a route or handler configured for the /files_on_server endpoint. Make sure that the server is configured to handle requests to this endpoint.
There may be a typo in the URL or a problem with the network connection. Double-check the URL to make sure it is correct and try again. If the problem persists, try pinging the server to check the network connection.
The server may be experiencing an issue or may be down for maintenance. In this case, you may need to contact the server administrator or wait for the issue to be resolved.
Thanks, got the same response from ChatGPT 😉
LOL
EXPOSED
But seriously, i would check out how the server is running, is it a proxy or what?
(1) Server is running, hence the reason I wrote that my other functions work.
(2) route or handler sounds closest but then I'm scratching my head as I'm still not sure how to manage that but can look into it.
(3) no typo, thats why I shared the information I did above
(4) not happening, it is a local server and all other functions work
It is a node.js server running on my laptop, same one I am running the client side code on.
Also, you can probably use curl or postman to try pinging the server which may help debug
I forgot the curl command but i can look it up itf needed
curl https://api.openai.com/v1/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer YOUR_API_KEY"
-d '{"model": "text-davinci-003", "prompt": "Say this is a test", "temperature": 0, "max_tokens": 7}'
is the command
Then you have to be somehow calling the open ai api incorrectly
This specific function does not use the OpenAI API
oh
It's to return the list of files in a directory on the node.js server
In order to fine tune GPT-3 you have to upload files to OpenAI. Before uploading it to OpenAI I want to store it on the node.js server.
So this function is to return the list of those file names to the client
And server logs dont say anything else besides the error you stated?
ok
Ima be honest, I'm new to this, i would recommend reaching out to a 'community helper' when one is online
Thank you, I'm brand new too. This is my first coding project
Cannot GET files_on_server
I wanted to run a quick test to make sure it wasn't something in the GET that was causing the issues so I changed the GET to:
console.log("this is being called.")
}```
Still I got the same error in the client as mentioned in my first message an no console log on the server. This implies the server isn't even running this.
This leads me to believe the issue is between the client and the server. My guess now is that the client is asking for `/files_on_server` and the server is instantly rejecting it claiming it doesn't understand the request.
I changed the GET on both sides to list_files_on_server incase the name of the GET was the issue, but still I get the same error.
I changed the fetch to app.get('/request_saved_combos') (a different one that was connected to a different button) and that worked.
So it really just does not like this app.get? The function on the server has to be the problem.
What I had before and it wasn't working:
app.get('/list_files_on_server'), async (req, res) => {
What I have now and it is working:
app.get('/list_files_on_server', async (req, res) => {