openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

Error: using nextjs-with-flask-server app is showing error

Open patriksharma opened this issue 2 years ago • 18 comments
trafficstars

I have installed the Server as per the readme file and run a client on the terminal.

the local host appeared and uploaded a doc, when trying to get an answer its displaying the below error.

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
event - compiled client and server successfully in 1182 ms (166 modules)
wait  - compiling...
event - compiled successfully in 100 ms (133 modules)
wait  - compiling / (client and server)...
event - compiled client and server successfully in 521 ms (757 modules)


INFO:werkzeug: * Debugger PIN: 105-174-659
INFO:werkzeug:127.0.0.1 - - [25/Feb/2023 11:56:49] "POST /process_file HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [25/Feb/2023 11:56:51] "OPTIONS /answer_question HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [25/Feb/2023 11:56:54] "POST /answer_question HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [25/Feb/2023 11:57:14] "POST /process_file HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [25/Feb/2023 11:57:24] "OPTIONS /answer_question HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [25/Feb/2023 11:57:27] "POST /answer_question HTTP/1.1" 200 -

Screenshot 2023-02-25 at 11 57 53 AM

patriksharma avatar Feb 25 '23 06:02 patriksharma

I get a similar error when trying to get an answer from the successfully uploaded document.

image

Sassun avatar Feb 25 '23 16:02 Sassun

got this aswell;

Error is triggered only when i upload a second file and ask a question; I can silence the error and get the system running by checking whether the parameters of the function existed; this results in unstable behavior

spent a short amount of time modifying the src/components/ files and made some changes which seemed to make an improvement but was unstable;

ismailntl avatar Mar 10 '23 22:03 ismailntl

How did you get it to upload. Mine doesn't upload, it gives the error POST http://localhost:8080/process_file net::ERR_CONNECTION_REFUSED

Ayo-faks avatar Mar 12 '23 11:03 Ayo-faks

Mine doesn't upload either!

image

troublesprouter avatar Mar 12 '23 15:03 troublesprouter

Hey @Ayo-faks and @troublesprouter are you running the server in a separate terminal tab, and did you add your own details to server/config.py? I also just pushed a change to the server initializing script that could help.

isafulf avatar Mar 12 '23 23:03 isafulf

same problem here. it just does not connect but the code seems correct. i even disabled my firewall but same problem. I wonder what it could be.

faksonbaba avatar Mar 13 '23 23:03 faksonbaba

Hey @Ayo-faks and @troublesprouter are you running the server in a separate terminal tab, and did you add your own details to server/config.py? I also just pushed a change to the server initializing script that could help.

Hello @isafulf , I still get the same error. Wonder why it's different for me. And yes, they are opened on different terminals. Can you test it out on codespaces or gitpod, maybe there is a port forwarding issue.

thanks

Ayo-faks avatar Mar 13 '23 23:03 Ayo-faks

Hey @Ayo-faks and @troublesprouter are you running the server in a separate terminal tab, and did you add your own details to server/config.py? I also just pushed a change to the server initializing script that could help.

I tried Linux now. It now attempts uploading but fails with "error processing file: AxiosError: Request aborted" in the console.

Any ideas how to make it work?

Yes, terminals are different.

troublesprouter avatar Mar 19 '23 15:03 troublesprouter

Update: it worked on Linux. I don't know why.

troublesprouter avatar Mar 20 '23 22:03 troublesprouter

Update: it worked on Linux. I don't know why.

Are you running it locally on your system? I have still not got it to work. any help, anyone!

Ayo-faks avatar Mar 21 '23 12:03 Ayo-faks

Update: it worked on Linux. I don't know why.

Are you running it locally on your system? I have still not got it to work. any help, anyone!

Yes, it ran locally. Try to find all places to add the API keys and use 3 terminal windows just to be safe.

Any advice on how to host it publicly with Vercel or something else? What's the simplest way?

I tried running vercel from the root directory but got a 404 error. Not sure what changes have to be made.

troublesprouter avatar Mar 21 '23 13:03 troublesprouter

I ran into this same problem, but I think it had to do with being rate limited. I was on the free trial and running too many requests per minute. I started waiting two-three minutes between questions and was able to get around this issue.

Related documentation: https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb

WaughB avatar Mar 21 '23 13:03 WaughB

Update: it worked on Linux. I don't know why.

Are you running it locally on your system? I have still not got it to work. any help, anyone!

Yes, it ran locally. Try to find all places to add the API keys and use 3 terminal windows just to be safe.

Any advice on how to host it publicly with Vercel or something else? What's the simplest way?

I tried running vercel from the root directory but got a 404 error. Not sure what changes have to be made.

My plan was to deploy the flask app as a container and then host the Nextjs app on vercel.

Do you remember the steps you took to make it work, what changed , where were you running it before? We have exactly the same problem.

faksonbaba avatar Mar 21 '23 16:03 faksonbaba

I tried mac without success. Don’t know the cause.

I set an openai api key inside the yaml config file too. Not sure that was there before.

Changed the start script command to python3 from python.

Hope that helps.

Is Vercel ok with both including flask or only with the nextjs part?

On Tue, 21 Mar 2023 at 16:28, faksonbaba @.***> wrote:

Update: it worked on Linux. I don't know why.

Are you running it locally on your system? I have still not got it to work. any help, anyone!

Yes, it ran locally. Try to find all places to add the API keys and use 3 terminal windows just to be safe.

Any advice on how to host it publicly with Vercel or something else? What's the simplest way?

I tried running vercel from the root directory but got a 404 error. Not sure what changes have to be made.

My plan was to deploy the flask app as a container and then host the Nextjs app on vercel.

Do you remember the steps you took to make it work, what changed , where were you running it before? We have exactly the same problem.

— Reply to this email directly, view it on GitHub https://github.com/openai/openai-cookbook/issues/159#issuecomment-1478172286, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGDEVWUB5K7YQV7HXKTXO3W5HJJLANCNFSM6AAAAAAVHVPTQI . You are receiving this because you were mentioned.Message ID: @.***>

troublesprouter avatar Mar 21 '23 16:03 troublesprouter

I tried mac without success. Don’t know the cause. I set an openai api key inside the yaml config file too. Not sure that was there before. Changed the start script command to python3 from python. Hope that helps. Is Vercel ok with both including flask or only with the nextjs part? On Tue, 21 Mar 2023 at 16:28, faksonbaba @.> wrote: Update: it worked on Linux. I don't know why. Are you running it locally on your system? I have still not got it to work. any help, anyone! Yes, it ran locally. Try to find all places to add the API keys and use 3 terminal windows just to be safe. Any advice on how to host it publicly with Vercel or something else? What's the simplest way? I tried running vercel from the root directory but got a 404 error. Not sure what changes have to be made. My plan was to deploy the flask app as a container and then host the Nextjs app on vercel. Do you remember the steps you took to make it work, what changed , where were you running it before? We have exactly the same problem. — Reply to this email directly, view it on GitHub <#159 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGDEVWUB5K7YQV7HXKTXO3W5HJJLANCNFSM6AAAAAAVHVPTQI . You are receiving this because you were mentioned.Message ID: @.>

For me it is easier to wrap my head around deploying it as a container.

I am almost giving up on this repo and @isafulf does not seem intrested

faksonbaba avatar Mar 21 '23 18:03 faksonbaba

If the maintainer sees this please add a quick guide to deploy with Vercel.

On Tue, 21 Mar 2023 at 18:15, faksonbaba @.***> wrote:

I tried mac without success. Don’t know the cause. I set an openai api key inside the yaml config file too. Not sure that was there before. Changed the start script command to python3 from python. Hope that helps. Is Vercel ok with both including flask or only with the nextjs part? … <#m_-1108222687762179029_> On Tue, 21 Mar 2023 at 16:28, faksonbaba @.> wrote: Update: it worked on Linux. I don't know why. Are you running it locally on your system? I have still not got it to work. any help, anyone! Yes, it ran locally. Try to find all places to add the API keys and use 3 terminal windows just to be safe. Any advice on how to host it publicly with Vercel or something else? What's the simplest way? I tried running vercel from the root directory but got a 404 error. Not sure what changes have to be made. My plan was to deploy the flask app as a container and then host the Nextjs app on vercel. Do you remember the steps you took to make it work, what changed , where were you running it before? We have exactly the same problem. — Reply to this email directly, view it on GitHub <#159 (comment) https://github.com/openai/openai-cookbook/issues/159#issuecomment-1478172286>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGDEVWUB5K7YQV7HXKTXO3W5HJJLANCNFSM6AAAAAAVHVPTQI https://github.com/notifications/unsubscribe-auth/ADGDEVWUB5K7YQV7HXKTXO3W5HJJLANCNFSM6AAAAAAVHVPTQI . You are receiving this because you were mentioned.Message ID: @.>

For me it is easier to wrap my head around deploying it as a container.

I am almost giving up on this repo and @isafulf https://github.com/isafulf does not seem intrested

— Reply to this email directly, view it on GitHub https://github.com/openai/openai-cookbook/issues/159#issuecomment-1478377997, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGDEVWREZQZHUMTH2GND23W5HV5FANCNFSM6AAAAAAVHVPTQI . You are receiving this because you were mentioned.Message ID: @.***>

troublesprouter avatar Mar 21 '23 18:03 troublesprouter

I get a similar error when trying to get an answer from the successfully uploaded document.

image

Im curious if anyone has gotten around this? When uploading larger document or more than one document it breaks here.

ismailntl avatar Mar 22 '23 19:03 ismailntl

Has anybody gotten this to work? I am trying to run this on Linux, but am getting an Axios ERR_CONNECTION_REFUSED when trying to upload a document. How do I get around this error? Also, @isafulf mentioned editing the server/config.py file with our own information. What needs to be edited in this file?

trprichard avatar Apr 12 '23 23:04 trprichard