azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

Using an Azure Cognitive Search from another resource group, but same subscription

Open Grantglass opened this issue 2 years ago • 3 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

any chat

Any log messages given by the failure

2023-06-28T20:18:48.919204349Z ERROR:root:Exception in /chat 2023-06-28T20:18:48.919276950Z Traceback (most recent call last): 2023-06-28T20:18:48.919283850Z File "/tmp/8db78141f8ae78f/app.py", line 116, in chat 2023-06-28T20:18:48.919288350Z r = impl.run(request.json["history"], request.json.get("overrides") or {}) 2023-06-28T20:18:48.919292750Z File "/tmp/8db78141f8ae78f/approaches/chatreadretrieveread.py", line 87, in run 2023-06-28T20:18:48.919311150Z results = [doc[self.sourcepage_field] + ": " + nonewlines(doc[self.content_field]) for doc in r] 2023-06-28T20:18:48.919316150Z File "/tmp/8db78141f8ae78f/approaches/chatreadretrieveread.py", line 87, in 2023-06-28T20:18:48.919320850Z results = [doc[self.sourcepage_field] + ": " + nonewlines(doc[self.content_field]) for doc in r] 2023-06-28T20:18:48.919324850Z File "/tmp/8db78141f8ae78f/antenv/lib/python3.10/site-packages/azure/search/documents/_paging.py", line 54, in next 2023-06-28T20:18:48.919346750Z return next(self._page_iterator) 2023-06-28T20:18:48.919350650Z File "/tmp/8db78141f8ae78f/antenv/lib/python3.10/site-packages/azure/core/paging.py", line 76, in next 2023-06-28T20:18:48.919354350Z self._response = self._get_next(self.continuation_token) 2023-06-28T20:18:48.919357850Z File "/tmp/8db78141f8ae78f/antenv/lib/python3.10/site-packages/azure/search/documents/_paging.py", line 114, in _get_next_cb 2023-06-28T20:18:48.919361650Z return self._client.documents.search_post( 2023-06-28T20:18:48.919365050Z File "/tmp/8db78141f8ae78f/antenv/lib/python3.10/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer 2023-06-28T20:18:48.919368750Z return func(*args, **kwargs) 2023-06-28T20:18:48.919372250Z File "/tmp/8db78141f8ae78f/antenv/lib/python3.10/site-packages/azure/search/documents/_generated/operations/_documents_operations.py", line 782, in search_post 2023-06-28T20:18:48.919375950Z raise HttpResponseError(response=response, model=error) 2023-06-28T20:18:48.919379550Z azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'

Expected/desired behavior

chat works

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) MacOS Ventura

azd version?

run azd version and copy paste here. azd version 1.0.2

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Grantglass avatar Jun 28 '23 20:06 Grantglass

Update: I tried to add the backend web app to the search service through IAM, but still get this error

023-06-28T23:58:59.994670383Z ERROR:root:Exception in /chat 2023-06-28T23:58:59.994719483Z Traceback (most recent call last): 2023-06-28T23:58:59.994724883Z File "/tmp/8db78301cf265df/app.py", line 116, in chat 2023-06-28T23:58:59.994728583Z r = impl.run(request.json["history"], request.json.get("overrides") or {}) 2023-06-28T23:58:59.994732483Z File "/tmp/8db78301cf265df/approaches/chatreadretrieveread.py", line 87, in run 2023-06-28T23:58:59.994735983Z results = [doc[self.sourcepage_field] + ": " + nonewlines(doc[self.content_field]) for doc in r] 2023-06-28T23:58:59.994739683Z File "/tmp/8db78301cf265df/approaches/chatreadretrieveread.py", line 87, in 2023-06-28T23:58:59.994743383Z results = [doc[self.sourcepage_field] + ": " + nonewlines(doc[self.content_field]) for doc in r] 2023-06-28T23:58:59.994746583Z File "/tmp/8db78301cf265df/antenv/lib/python3.10/site-packages/azure/search/documents/_paging.py", line 54, in next 2023-06-28T23:58:59.994749783Z return next(self._page_iterator) 2023-06-28T23:58:59.994752983Z File "/tmp/8db78301cf265df/antenv/lib/python3.10/site-packages/azure/core/paging.py", line 76, in next 2023-06-28T23:58:59.994756183Z self._response = self._get_next(self.continuation_token) 2023-06-28T23:58:59.994759383Z File "/tmp/8db78301cf265df/antenv/lib/python3.10/site-packages/azure/search/documents/_paging.py", line 114, in _get_next_cb 2023-06-28T23:58:59.994762683Z return self._client.documents.search_post( 2023-06-28T23:58:59.994774583Z File "/tmp/8db78301cf265df/antenv/lib/python3.10/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer 2023-06-28T23:58:59.994778283Z return func(*args, **kwargs) 2023-06-28T23:58:59.994781383Z File "/tmp/8db78301cf265df/antenv/lib/python3.10/site-packages/azure/search/documents/_generated/operations/_documents_operations.py", line 782, in search_post 2023-06-28T23:58:59.994784783Z raise HttpResponseError(response=response, model=error) 2023-06-28T23:58:59.994788183Z azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'

Grantglass avatar Jun 29 '23 00:06 Grantglass

Hi, I am also facing the same problem

Aravind03 avatar Jul 02 '23 17:07 Aravind03

I think one aspect is to make sure you store the documents in a storage blob, but what if you store Json, do you need to change this code in the app.py file? Screenshot 2023-07-03 at 4 33 49 PM

Grantglass avatar Jul 03 '23 20:07 Grantglass

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.

github-actions[bot] avatar Sep 02 '23 01:09 github-actions[bot]

I have added a specific section to the readme about using a search service from another resource group. It should work fine (per the tests I've done) but if you're getting forbidden errors, please make sure the roles are also set up appropriately for the app service to access the search service.

pamelafox avatar Sep 18 '23 20:09 pamelafox

Closing this issue, but please comment or open a new issue if you believe there's an open issue.

pamelafox avatar Sep 18 '23 20:09 pamelafox