kiri-art / stable-diffusion-react-nextjs-mui-pwa

PWA Web App front end for Stable Diffusion, on React/NextJS with Material UI
https://kiri.art/
MIT License
132 stars 32 forks source link

Mongo errors even with REQUIRE_REGISTRATION set to false #37

Open gadicc opened 2 years ago

gadicc commented 2 years ago

As reported by sching#7491 on discord.

image image image

gadicc commented 2 years ago

Ok, to get rid of all the non-critical errors is a bigger job, but at least now you can run requests! :sweat_smile:

sonicviz commented 2 years ago

Hi, This looked interesting so I thought I'd test it out.

I'm running the standard install with yarn dev and getting this error.

It's connecting to banana remote ok (needs key BANANA_MODEL_KEY_SD_v1_5 btw) but if I enter a prompt it returns no prompt used with the above mongodb error.

Error in subscribe({"name":"accounts","updatedAt":{}}): MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 at Timeout._onTimeout (E:\Source Control\AI Stable Diffusion\sv-stable-diffusion-react-nextjs-mui-pwa\node_modules\mongodb\lib\sdam\topology.js:293:38) at listOnTimeout (node:internal/timers:564:17) at process.processTimers (node:internal/timers:507:7) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { '127.0.0.1:27017' => [ServerDescription] }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, setName: null, maxElectionId: null, maxSetVersion: null, commonWireVersion: 0, logicalSessionTimeoutMinutes: null

Any clues?

Thanks!

gadicc commented 2 years ago

Hey! Welcome!

My guess is that you're maybe using banana's serverless-template-stable-diffusion repo like I stupidly still ask you to in the docs, instead of the newer https://github.com/kiri-art/docker-diffusers-api. Is that possible? I'm going to fix this in the docs right now!

I am super around to help troubleshoot this repo, it's a bit neglected towards contributors because more people seemed interested in the container, but I'd love to fix that.

Well done on getting up and running on banana so quick!

gadicc commented 2 years ago

And sorry for the hassle from the out-of-date docs! But fixed now :blush:

sonicviz commented 2 years ago

Ok, thanks.

I have docker, but I really want to run it remotely as I'm not interested in a local install of SD. So there's no remote support in it now, is what you're saying?

gadicc commented 2 years ago

Oh no, there's totally remote support. But what image do you have deployed on banana?

sonicviz commented 2 years ago

I used the 1-click deploy of SD, as specified on Banana serverless Instant Deploy Stable Diffusion is now available as a prebult model on Banana! See how to deploy Stable Diffusion in seconds. https://github.com/bananaml/serverless-template-stable-diffusion

Does that not work? I need to clone the github repo and deploy that on Banana instead? Where is it pulling the model from, huggingface?

gadicc commented 2 years ago

Ah gotcha. So we don't work with that one. It's too limited. You need to deploy https://github.com/kiri-art/docker-diffusers-api.

Yes, exactly! It's pretty easy... clone, edit the Dockerfile with your HF_AUTH_TOKEN and whatever other var changes you want (build vars landing soon on Banana web UI which will make this easier), commit, push, and add the repo on the Banana dashboard. Just note that any custom model (including their own starter repo when not used through 1-click) can take around an hour to build.

And yes, it will download any model you specify from huggingface, OR, if you have a fine-tuned model, there's a CHECKPOINT_URL var in the Dockerfile which will download it and convert to diffusers format at build time.

sonicviz commented 2 years ago

ah, I see. The doc wasn't updating with your edit, it's now Follow instructions at https://github.com/kiri-art/docker-diffusers-api.

So I clone that repo, hook it up to Banana to CI it and deploy, then use its keys for the app?

gadicc commented 2 years ago

Exactly! :tada:

sonicviz commented 2 years ago

Gotcha. Thanks for the quick support! (same last name btw;-) It's late here in Tokyo, going to crash and I'll take a run at this again tomorrow.

gadicc commented 2 years ago

Haha I noticed that fellow high priest! ;)

Sounds good. Holler if you need anything, I'm on the banana discord too.

おやすみ :ok_hand:

sonicviz commented 2 years ago

L8rs, thanks!

sonicviz commented 2 years ago

Ok, got it all working. I think the docs on the backend could be a little clearer, with actual examples of configuration files etc.

Will have a play with it, let you know if I see any issues/suggestions. Thanks!

sonicviz commented 2 years ago

Issue #1

Is the signup flow working?

I tired locally and from a vercel deployment but get browser console and popup errors: (ex for github) Unhandled Runtime Error Error: No such service: github

Locally with no require registration it lets you use it ie: no login. Vercel doesn't let you use it as even if you have no require registration it needs login, not go.

eg console log from Vercel deployment

/api/gongoPoll:1 Failed to load resource: the server responded with a status of 504 ()

Uncaught (in promise) Error: No such service: github at default. (_app-6d56bdb4d80a8597.js?WB_REVISION__=6d56bdb4d80a8597:74:142361) at Generator.next () at _app-6d56bdb4d80a8597.js?WB_REVISION=6d56bdb4d80a8597:74:140549 at new Promise () at _app-6d56bdb4d80a8597.js?__WB_REVISION=6d56bdb4d80a8597:74:140294 at default.loginWithService (_app-6d56bdb4d80a8597.js?WB_REVISION=6d56bdb4d80a8597:74:142241) at onClick (login-7f752cdf14df4e90.js?WB_REVISION=7f752cdf14df4e90:1:2599) at Object.Oe (framework-4556c45dd113b893.js?WB_REVISION=4556c45dd113b893:1:16874) at Ae (framework-4556c45dd113b893.js?WB_REVISION=4556c45dd113b893:1:17028) at framework-4556c45dd113b893.js?__WB_REVISION__=4556c45dd113b893:1:36928

I see that's coming from pages\api\gongoAuth.ts

How is this doing the db conneciton for storing authenticated users and other needed db info? I'm pretty familiar with db work, but typically have a mongo db or mysql running somewhere. I've done some serverless function projects on AWS, but this looks to be a serverless mongodb? import GongoServer from "gongo-server/lib/serverless";

That's something I'm not familiar with (yet) so sounds like a good time to learn. Looks to me (from the 504 above) that mongodb is not setup perhaps?

Something else for the docs too, a high level application architecture diagram or summary would be really useful to understand how it's put together.

Issue #2 Running locall I get a lot of errors in the terminal, one copied below. Mongo as well, maybe related to issue #1?

Error in subscribe({"name":"userLikes","updatedAt":{}}): MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 at Timeout._onTimeout (E:\Source Control\AI Stable Diffusion\sv-sd1-frontend\node_modules\mongodb\lib\sdam\topology.js:293:38) at listOnTimeout (node:internal/timers:564:17) at process.processTimers (node:internal/timers:507:7) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { '127.0.0.1:27017' => [ServerDescription] }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, setName: null, maxElectionId: null, maxSetVersion: null, commonWireVersion: 0, logicalSessionTimeoutMinutes: null }, code: undefined, [Symbol(errorLabels)]: Set(0) {} }

gadicc commented 2 years ago

Hey, well done on it getting it up and running! And thanks for the feedback, I'd love to start making this all clearer. Good idea re the higher level summary.

Gongo is my own custom data layer that I've been developing over the last few years in my spare time... it does indeed work serverless and provides an offline-first mongo-like client-side database stored in indexeddb in the browser, with nice react bindings around it. It has a lot of gotchas though and probably isn't useful for anyone else at this time (but it is all open source).

Ok so assuming you have all the required oauth2 environment variables set, and yes, there's no way you could have possibly known this (sorry!!!), you need to call /api/gongoAuth?type=setup once to update :sweat_smile: But yes you absolutely need to have Mongo setup for any registration and login features to work (e.g. free instance on mongodb.com, and set the MONGO_URL in vercel).

Yeah all the errors locally when mongo isn't installed, is this very issue (#37)... I need to get to that. And with REQUIRE_REGISTRATION=0 it really should work on vercel too (without login), I know of at least one person doing it but it is an older release so maybe I broke something, will definitely look into this, but will probably only have a chance towards the end of the week :/ I think in the meantime if you don't want to wait, quickest way would be to set up mongo.

Keep me posted. Unfortunately priority right now is a few things on the container that everyone is waiting for (big speed improvements which will save us all money!). But will definitely keep checking in and answer any questions I can in the meantime, would love to get you up and running well with all this!

sonicviz commented 2 years ago

Thanks for the detailed explanation.