ShiftHackZ / Stable-Diffusion-Android

Stable Diffusion AI client app for Android
https://sdai.moroz.cc
GNU Affero General Public License v3.0
663 stars 64 forks source link

API error: POST [SSL: CERTIFICATE_VERIFY_FAILED] #110

Open Joly0 opened 9 months ago

Joly0 commented 9 months ago

Describe the bug When i try to generate an image using the app, i get an error 500 and in the logs of stable-diffusion-webui i see this:

*** API error: POST: http://192.168.178.220:9000/sdapi/v1/txt2img {'error': 'URLError', 'detail': '', 'body': '', 'errors': '<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)>'}
    Traceback (most recent call last):
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 98, in receive
        return self.receive_nowait()
               ^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 93, in receive_nowait
        raise WouldBlock
    anyio.WouldBlock

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 78, in call_next
        message = await recv_stream.receive()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 118, in receive
        raise EndOfStream
    anyio.EndOfStream

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/config/02-sd-webui/webui/modules/api/api.py", line 186, in exception_handling
        return await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 84, in call_next
        raise app_exc
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 108, in __call__
        response = await self.dispatch_func(request, call_next)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/modules/api/api.py", line 150, in log_and_time
        res: Response = await call_next(req)
                        ^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 84, in call_next
        raise app_exc
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 84, in __call__
        await self.app(scope, receive, send)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 24, in __call__
        await responder(scope, receive, send)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 44, in __call__
        await self.app(scope, receive, self.send_with_gzip)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
        raise exc
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
        await self.app(scope, receive, sender)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
        raise e
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
        await self.app(scope, receive, send)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
        await route.handle(scope, receive, send)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
        await self.app(scope, receive, send)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
        response = await func(request)
                   ^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app
        raw_response = await run_endpoint_function(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/fastapi/routing.py", line 165, in run_endpoint_function
        return await run_in_threadpool(dependant.call, **values)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
        return await anyio.to_thread.run_sync(func, *args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync
        return await get_asynclib().run_sync_in_worker_thread(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
        return await future
               ^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 807, in run
        result = context.run(func, *args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/modules/api/api.py", line 379, in text2imgapi
        processed = process_images(p)
                    ^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/modules/processing.py", line 734, in process_images
        res = process_images_inner(p)
              ^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/webui/modules/processing.py", line 808, in process_images_inner
        sd_vae_approx.model()
      File "/config/02-sd-webui/webui/modules/sd_vae_approx.py", line 53, in model
        download_model(model_path, 'https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/download/v1.0.0-pre/' + model_name)
      File "/config/02-sd-webui/webui/modules/sd_vae_approx.py", line 39, in download_model
        torch.hub.download_url_to_file(model_url, model_path)
      File "/config/02-sd-webui/webui/venv/lib/python3.11/site-packages/torch/hub.py", line 611, in download_url_to_file
        u = urlopen(req)
            ^^^^^^^^^^^^
      File "/config/02-sd-webui/env/lib/python3.11/urllib/request.py", line 216, in urlopen
        return opener.open(url, data, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/env/lib/python3.11/urllib/request.py", line 519, in open
        response = self._open(req, data)
                   ^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/env/lib/python3.11/urllib/request.py", line 536, in _open
        result = self._call_chain(self.handle_open, protocol, protocol +
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/env/lib/python3.11/urllib/request.py", line 496, in _call_chain
        result = func(*args)
                 ^^^^^^^^^^^
      File "/config/02-sd-webui/env/lib/python3.11/urllib/request.py", line 1391, in https_open
        return self.do_open(http.client.HTTPSConnection, req,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/config/02-sd-webui/env/lib/python3.11/urllib/request.py", line 1351, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)>

---

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior No error

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

ShiftHackZ commented 7 months ago

Hello. Looks like this is the API related problem, so please consider reporting this issue to the Automatic1111 issue tracker.