dr413677671 / PromptGallery-stable-diffusion-webui

A prompt cookbook worked as stable-diffusion-webui extenstions.
Apache License 2.0
151 stars 16 forks source link

buttons on Prompt Gallery don't work (AxiosError: Network Error) #11

Closed charliehaydenhicks closed 1 year ago

charliehaydenhicks commented 1 year ago

Thanks for the great feature set. I'm dying to get this working.

I managed to get this working all the way up until the point where I click "send to webui" or "copy negatives" or any of those buttons. They all return this error in the console:

AxiosError: Network Error
    at u.onerror (http://localhost:5173/assets/index.bed48b02.js:42:4558)

I did use the command prompts as described (cors, api). Any thoughts appreciated

charliehaydenhicks commented 1 year ago

I forgot to mention that the terminal didn't do anything, so nothing to copy/paste from there. Just the chrome terminal.

dr413677671 commented 1 year ago

@charliehaydenhicks Thanks for sending the issue.

Did you use remotely?

If using remotly add parmas like this: --cors-allow-origins http://remote-ip:5173/ --api --listen --server-name remote-ip

charliehaydenhicks commented 1 year ago

No, was local only. Do you think it could have something to do with certificates/https?

dr413677671 commented 1 year ago

Maybe port 5173 closed?

dr413677671 commented 1 year ago

I just noticed that you mentioned you use it on Colab. Please make sure you could visit port 5173.

charliehaydenhicks commented 1 year ago

This was actually on my home machine. Port 5173 was available to me (i.e. going to localhost:5173 resolved to the extension page). Also, the extension page loads when running the webui, it's only when you click on the buttons at the bottom of the page that it doesn't do anything.

Maybe there's something preventing the app from accessing 5173, how could I check that?

charliehaydenhicks commented 1 year ago

Just to be clear: this was not on Colab. It was a local install (not a jupyter notebook).

This might not be a cors issue, I think it might be an iFrames permissions issue. The page loads, and it's able to read the thumbnail file from the /preview/ folder, this wasn't happening in colab. I think because of cors issues.

On the local machine, I think cors is working, it just doesn't do anything when clicking the button. I fixed this problem for the copy/paste buttons (by changing the iFrame permissions in the html file). But I don't know what to try for the other buttons.

charliehaydenhicks commented 1 year ago

Digging a little more. Found this issue\ in the console: ICookie samesite not set: Specify SameSite=None and Secure if the cookie should be sent in cross-site requests. This enables third-party use.

charliehaydenhicks commented 1 year ago

please also add allow="clipboard-read; clipboard-write" to the iframe tags

dr413677671 commented 1 year ago

CORS should be workaround by add param --cors-allow-origins http://localhost:5173/ to webui

dr413677671 commented 1 year ago

Thanks! I added allow="clipboard-read; clipboard-write" . Unblock the copy and paste now. But I still do not understand why I could not repro: AxiosError: Network Error at u.onerror (http://localhost:5173/assets/index.bed48b02.js:42:4558)

dr413677671 commented 1 year ago

I think 8888 might be your local jupyter notebook. This is not affected.

Web page do not store cookies. Web browser does. I checked the code of xsrf. Axios requests an xsrf protected action from http://'+ip+':'+port+'/sdapi/v1/txt2img' via a POST request. This happens when calling web-ui API.

From your description. It might be your browser setting that block this activity. One assumption is your are using browser like firefox which has a STRICT samesite config. Try lower ths level or use chrome. I dont th

charliehaydenhicks commented 1 year ago

I think I found it!!!! Webui is running on 127.0.0.1 and the extension is runnning on localhost. Apparently Chrome thinks these are different domains!

I'll see if I can figure out how to run webui on localhost and see if that fixes it.

image

charliehaydenhicks commented 1 year ago

Okay, I added the flag --listen to the command arguments. The error message changed slightly but the main error remains.

I think it's because the extension is running on http and automatic1111 webui is running on https. If I can figure out how to change either one of them I think it will work.

Any ideas?

Edit: --listen did change both domains to localhost edit: but it didn't change to https

charliehaydenhicks commented 1 year ago

Okay, I'm pretty sure the issue is the cookies from your extension aren't https. image image

dr413677671 commented 1 year ago

I could not use https since webui is not https. Do you by any chance know how to make it work?

dr413677671 commented 1 year ago

On my env. AUTOMATIC1111 webui run in http image

muunkky commented 1 year ago

Interesting, mine runs in https automatically. I wish I could get it to run in http

dr413677671 commented 1 year ago

Could you try alter param http in this line.

dr413677671 commented 1 year ago
cors

@muunkky @charliehaydenhicks I added some instructions in Readme on how to update the ip and port. Please upgrade the extension and follow the exeact instructions. I checked that webui do not add any setup to contraint it to https/http. This might be a environment issue. Clould service might redirect http to https.

It is not considered as an extension issue as running locally it is good.