microsoft / botbuilder-tools

Welcome to the Bot Framework Tools repository, which is the home for a set of tools for developers building bots with the Microsoft Bot Framework
https://github.com/Microsoft/botframework
MIT License
444 stars 262 forks source link

"dispatch create" gets 401 permission denied when adding qna db b/c of invalid endpoint #1488

Closed ObsidianDelta closed 3 years ago

ObsidianDelta commented 3 years ago

Tool

Name: [Msbot|Ludown|LUIS|QnAMaker|Chatdown|Dispatch|LuisGen] Version: tool version OS: os version

Describe the bug

When I try to add the newly created qna db using the correct id and subscription key I get the following error message:

Request url: https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/xxxx-xxx-xxx-xxxx/Test/qna?getFlattened=true Response: {"error":{"code":"401","message":"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}

The end point is wrong! It should be https://qnaxxx.cognitiveservices.azure.com/qnamaker/v5.0-preview.1 ... or something to that effect.

To Reproduce

Steps to reproduce the behavior:

  1. ... dispatch add

  2. ... dispatch add --type "qna" --name "Faq" --id "xxx.xxx.xxxx.xxx" --key "xxx.xxx.xxx.xxx" --intentName "q_Faq" --dataFolder "c:\Users\Jason" --dispatch "c:\Users\Jason\dispatch.dispatch"

  3. ... dispatch create

  4. ... permission denied

Expected behavior

There should be an option to put in the request url to the correct one so that it functions as expected

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

[bug]

stevkan commented 3 years ago

@ObsidianDelta, can you tell me the version of dispatch that you are using? In the mean time, I will begin attempting a repro of this and assume you are using the latest.

ObsidianDelta commented 3 years ago

@ObsidianDelta, can you tell me the version of dispatch that you are using? In the mean time, I will begin attempting a repro of this and assume you are using the latest.

1.7.2

ObsidianDelta commented 3 years ago

@ObsidianDelta, can you tell me the version of dispatch that you are using? In the mean time, I will begin attempting a repro of this and assume you are using the latest.

Hey @stevkan do you think its just how I am invoking dispatch or do you think there is something going on in terms of a bug?

VanesaMartin commented 3 years ago

I have the same problem and I think its because I am using qna managed in preview version. Is there a way to change the endpoint Request url: https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/xxxxx-xxxx-xxxx-xxxxx/Test/qna?getFlattened=true? My cognitive service is in north europe not westus and publish on https://xxxxxxx.cognitiveservices.azure.com/qnamaker/v5.0-preview.1

My dispatch version is 1.7.2

ObsidianDelta commented 3 years ago

I have the same problem and I think its because I am using qna managed in preview version. Is there a way to change the endpoint Request url: https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/xxxxx-xxxx-xxxx-xxxxx/Test/qna?getFlattened=true? My cognitive service is in north europe not westus and publish on https://xxxxxxx.cognitiveservices.azure.com/qnamaker/v5.0-preview.1

My dispatch version is 1.7.2

I tried both ... I still get the same result! It's because the base URL is custom I believe is that right @stevkan @v-kydela @ckkashyap ?

ObsidianDelta commented 3 years ago

It works ... I used the subscription id instead of the subscription key!

sschutten commented 3 years ago

@ObsidianDelta can you please elaborate? I can't seem to find a way to tell the dispatch tool to use a different endpoint for the v5.0 managed preview QnAMaker knowledgebases.

ObsidianDelta commented 3 years ago

@ObsidianDelta can you please elaborate? I can't seem to find a way to tell the dispatch tool to use a different endpoint for the v5.0 managed preview QnAMaker knowledgebases.

I got it to work with the un managed version. Not the preview version. However I don't think it matters. Just make sure you use the subscription key for the qna service ... not the subscription id.

sschutten commented 3 years ago

Unfortunately, it doesn't work with the preview version of QnAMaker because it uses the incorrect endpoint. There's no option to specify the endpoint, or at least no option I know of.

lemoncookie commented 3 years ago

Unfortunately, it doesn't work with the preview version of QnAMaker because it uses the incorrect endpoint. There's no option to specify the endpoint, or at least no option I know of.

I've just tested this and came to the conclusion that it is not possible to use the managed qna maker in the preview (tested with an european server). For anybody who wants to reproduce the steps:

  1. Create a managed qna maker (preview) in the european region (so far only northeurope is possible)
  2. Follow the steps of the documentation (e.g. https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=cs#create-the-dispatch-model -this also covers the first step)
  3. Try to use the botdispatch (I used @1.7.4) - "dispatch create"
  4. You will run into an error described above and notice two things: the region is set to westus and the version is v4.0 instead of v5.0-preview.1
  5. You can change the region of the qna maker to 'northeurope' in the 'x.dispatch' file. It is not possible to change the version!
  6. Try "dispatch create" again
  7. You run into: "Response: {"error":{"code":"401","message": "The Download Knowledgebase Operation under QnA Maker V4.0 is not supported with the current subscription key and pricing tier QnAMaker.v2.S0."}}"

The last error suggests that the pricing tier is the issue, but it says so for the QnA Maker V4.0. As described the v5.0-preview.1 is in use here. Anybody tried this with another price tier?

When I use the unmanaged QnA Maker everything works. Unfortunately it is not possible to set the region of the QnA Maker on creation. So it's set to westus..