Nutlope / roomGPT

Upload a photo of your room to generate your dream room with AI.
https://www.roomgpt.io/
MIT License
9.78k stars 1.29k forks source link

api/generate:1 Failed / dream:1 Uncaught #66

Closed R3P-tech closed 1 year ago

R3P-tech commented 1 year ago

api/generate:1 Failed to load resource: the server responded with a status of 504 () dream:1 Uncaught (in promise) SyntaxError: Unexpected token 'A', "An error o"... is not valid JSON

I'm using Vercel, after few test, it can randomly happen that image doesn't generate and credits are used. All requests are generated on Replicate, it just doesn't return to server, it keeps loading forever and i've got some errors in console

Environment Variables:

DATABASE_URL=postgres://3xample:password@ep-white-mode-652705-pooler.us-east-2.aws.neon.tech/neondb?pgbouncer=true DIRECT_DATABASE_URL=postgres://3xample:password@ep-white-mode-652705.us-east-2.aws.neon.tech/neondb SHADOW_DATABASE_URL=postgres://3xample:password@ep-white-mode-652705.us-east-2.aws.neon.tech/shadow_db

Similar cases #69 #25 Maybe @Nutlope could have a quick look and help us ? Thanks

Capture d’écran 2023-04-13 à 15 36 24 Capture d’écran 2023-04-13 à 15 27 15
boss2256 commented 1 year ago

i have the same error info - Loaded env from /var/task/.env error

benderlidze commented 1 year ago

Hey, looks like the problem is in generate.ts use generatedImage = jsonFinalResponse.output[0] as string; instead of generatedImage = jsonFinalResponse.output[1] as string;

boss2256 commented 1 year ago

Hey, looks like the problem is in generate.ts use generatedImage = jsonFinalResponse.output[0] as string; instead of generatedImage = jsonFinalResponse.output[1] as string;

Hey i've already changed, the image uploaded was actually sent to replicate and upload.io but it did not return on my page. problem ![Uploading problem.png…]() generate ts replicaete

boss2256 commented 1 year ago

it keeps on loading forever, and it did not appear on my dashboard

goyalpramod commented 1 year ago

@R3P-tech @boss2256 Were you able to fix the issue?

fewjative commented 1 year ago

@boss2256 @goyalpramod @R3P-tech

TLDR: You need to upgrade to vercel pro plan.

If you're getting a 504 error, it's likely because the generate API took longer than ten seconds. If you look at the last image in the first post, the right pane shows the duration as 10.01 s and limit is 10 seconds. Aka it took too long. If you deploy locally, there is NO time limit. However, when you are on production, you have time limits. If you are on hobby, serverless functions have a max run time of 10 seconds. On pro, they have a runtime max of 60.

R3P-tech commented 1 year ago

@fewjative Thanks, did you try with the new model from pull request #67 ? Vercel pro solved the problem and works with the old model, but with the new model and vercel pro images are not generated.

goyalpramod commented 1 year ago

@fewjative thank you for the explanation, it helped tremendously.