Open kk0205 opened 4 months ago
The error shows when AZURE_USE_AUTHENTICATION="true"
Hello @kk0205, that log does not actually indicate an error. It is showing you the chain of credential types that it tries until it succeeds. It first tries environment credential, and when it doesn't see all the environment variables needed, it moves on to ManagedIdentity, which fails. It finally succeeds with AzureCliCredential, so you must have logged in with az login. That's fine, as long as you're logged in with the account that did the provisioning.
Let me know if you think you've run into an actual error.
Thanks for quick reply. Here's the whole log for it, after trying az login and azd auth login the same error still appears.
INFO:azure.identity.aio._credentials.environment:Incomplete environment configuration for EnvironmentCredential. These variables are set: AZURE_TENANT_ID
INFO:azure.identity.aio._credentials.managed_identity:ManagedIdentityCredential will use IMDS
INFO:azure.core.pipeline.policies.http_logging_policy:Request URL: 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=REDACTED&resource=REDACTED'
Request method: 'GET'
Request headers:
'User-Agent': 'azsdk-python-identity/1.15.0 Python/3.11.9 (Windows-10-10.0.22621-SP0)'
No body was attached to the request
INFO:azure.identity.aio._credentials.chained:DefaultAzureCredential acquired a token from AzureCliCredential
INFO:azure.core.pipeline.policies.http_logging_policy:Request URL: 'https://gptkb-qugljroubmxl2.search.windows.net/indexes('gptkbindex')?api-version=REDACTED'
Request method: 'GET'
Request headers:
'Accept': 'application/json'
'x-ms-client-request-id': '921f7865-0cd2-11ef-93c3-047f0e34681b'
'User-Agent': 'azsdk-python-search-documents/11.6.0b1 Python/3.11.9 (Windows-10-10.0.22621-SP0)'
'Authorization': 'REDACTED'
No body was attached to the request
INFO:azure.core.pipeline.policies.http_logging_policy:Response status: 401
Response headers:
'Transfer-Encoding': 'chunked'
'Content-Language': 'REDACTED'
'Server': 'Microsoft-IIS/10.0'
'Strict-Transport-Security': 'REDACTED'
'Preference-Applied': 'REDACTED'
'WWW-Authenticate': 'Bearer realm="Azure Cognitive Search" error="invalid_token" error_description="Authentication token failed validation."'
'request-id': '921f7865-0cd2-11ef-93c3-047f0e34681b'
'elapsed-time': 'REDACTED'
'Strict-Transport-Security': 'REDACTED'
'Date': 'Wed, 08 May 2024 00:33:23 GMT'
ERROR:app:Exception
Traceback (most recent call last):
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\app.py", line 1671, in startup
await self.ensure_async(func)()
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\backend\app.py", line 412, in setup_clients
search_index = await search_index_client.get_index(AZURE_SEARCH_INDEX)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\core\tracing\decorator_async.py", line 88, in wrapper_use_tracer
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\search\documents\indexes\aio\_search_index_client.py", line 147, in get_index
result = await self._client.indexes.get(name, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\core\tracing\decorator_async.py", line 88, in wrapper_use_tracer
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\search\documents\indexes\_generated\aio\operations\_indexes_operations.py", line 656, in get
map_error(status_code=response.status_code, response=response, error_map=error_map)
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\core\exceptions.py", line 164, in map_error
raise error
azure.core.exceptions.ClientAuthenticationError: Operation returned an invalid status 'Unauthorized'
Traceback (most recent call last):
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\asgi.py", line 320, in __call__
await self.app.startup()
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\app.py", line 1671, in startup
await self.ensure_async(func)()
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\backend\app.py", line 412, in setup_clients
search_index = await search_index_client.get_index(AZURE_SEARCH_INDEX)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\core\tracing\decorator_async.py", line 88, in wrapper_use_tracer
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\search\documents\indexes\aio\_search_index_client.py", line 147, in get_index
result = await self._client.indexes.get(name, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\core\tracing\decorator_async.py", line 88, in wrapper_use_tracer
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\search\documents\indexes\_generated\aio\operations\_indexes_operations.py", line 656, in get
map_error(status_code=response.status_code, response=response, error_map=error_map)
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\azure\core\exceptions.py", line 164, in map_error
raise error
azure.core.exceptions.ClientAuthenticationError: Operation returned an invalid status 'Unauthorized'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\__main__.py", line 6, in <module>
main()
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\cli.py", line 754, in main
cli.main()
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\click\decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\cli.py", line 639, in run_command
app.run(
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\app.py", line 850, in run
loop.run_until_complete(asyncio.gather(*tasks))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\hypercorn\asyncio\__init__.py", line 44, in serve
await worker_serve(
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\hypercorn\asyncio\run.py", line 87, in worker_serve
raise exception
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\hypercorn\asyncio\lifespan.py", line 43, in handle_lifespan
await self.app(
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\hypercorn\app_wrappers.py", line 34, in __call__
await self.app(scope, receive, send)
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\app.py", line 1638, in __call__
await self.asgi_app(scope, receive, send)
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\app.py", line 1664, in asgi_app
await asgi_handler(receive, send)
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\quart\asgi.py", line 322, in __call__
await send(
File "C:\Users\k1110205\Desktop\azure\knshgpt-test\app\.venv\Lib\site-packages\hypercorn\asyncio\lifespan.py", line 101, in asgi_send
raise LifespanFailureError("startup", message.get("message", ""))
hypercorn.utils.LifespanFailureError: Lifespan failure in startup. 'Operation returned an invalid status 'Unauthorized''
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002D7F2439790>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002D7F2DBF8C0>, 159628.656)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002D7F240D9D0>
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002D7F2442310>
Hello @pamelafox , I am also getting this error and app is not running. I set AZURE_USE_AUTHENTICATION to true and also set this: azd env set USE_USER_UPLOAD true before running and up.
Now app is throwing this message given above and not running.
What can I do about it? or did I miss anything? do I have to run anything else before deploying the app to enable users to have separate libraries?
thanks
The error below shows when running locally
It rans fine few days ago