botkit-middleware icon indicating copy to clipboard operation
botkit-middleware copied to clipboard

Error: 404 Resource not Found

Open Mattw11486 opened this issue 3 years ago • 17 comments

image image image

I am getting this error when trying to integrate the Watson Assistant to the botkit. It boots up fine but when trying to send a message to trigger the response from Watson I get this error.

Mattw11486 avatar Aug 06 '22 03:08 Mattw11486

According to https://github.com/ibm-cloud-docs/watson/blob/master/endpoints-change.md

The watsonplatform.net endpoint URLs were retired on 26 May 2021. Update your API calls to use new URLs.

You can find instructions how to find correct endpoint at https://cloud.ibm.com/apidocs/assistant-v1#endpoint-cloud

Naktibalda avatar Aug 06 '22 07:08 Naktibalda

Maybe I am not looking in the right spot for the endpoints as well as API credentials When I open up Watson Assistance and then click on settings I do not see a URL that links to a workspace nor can I find a workspace ID that matches what it requests in the middleware's .env files ASSISTANT_URL=https://api.us-south.assistant.watson.cloud.ibm.com/instances/Imyinstanceid}/v2/assistants/(environmentid)/sessions ASSISTANT_IAM_APIKEY=theapikey I am getting from the screenshot WORKSPACE_ID=assistant id image

Mattw11486 avatar Aug 07 '22 02:08 Mattw11486

I think the main issue from what I can gather is that the middleware was written with Watson Assistant version 1 and I see no way of reverting the Assistant from version 2 back to version 1. I can switch to classic experience in the IBM Cloud Manager however the Get API Details that used to be in skills is no longer there so I see no way of getting a workspace_ID that is being required for the middleware authentication.

Mattw11486 avatar Aug 07 '22 06:08 Mattw11486

Sorry, I can't help with that, I haven't used this library or Watson Assistant since April 2021.

Naktibalda avatar Aug 07 '22 11:08 Naktibalda

@Mattw11486 and @Naktibalda , while I'm not sure this will answer your question, I thought I should mention a few details I'm aware of:

  • You should be able to use Watson Assistant V1 API in parallel with your use of the V2 API (IBM has claimed this for a long time, explaining that the v1 API is still around until v2 offers similar functionality level. As far as I understand, V1 is the only one that gives you direct access to a skill though. It's also the one I've been using since 2018 in my bots)
  • Having said the above, I'm not sure yet how to use V1 with an actual assistant instance (My old bots still use no 'assistant' instance, requiring an orchestration engine, which is mainly what I use botkit for, and then I connect to the skill using V1). I'm afraid that there might be no way to connect to V1 from within an assistant unless somebody upgrades the botkit-middleware module. If somebody is willing to do this, I'd suggest that there should be an option to use either V1 or V2 within the middleware (so as not to disrupt existent bots that depend on V1, for example). Disclaimer: I have not tried to do what you have done, as I'm yet to create a 'new' Watson Assistant instance and changing to the 'classic' experience - and hope that I can still connect via V1 to my skills. I'm hoping to experiment with this soon, but I haven't had the chance yet.

pgoldweic avatar Aug 09 '22 14:08 pgoldweic

@pgoldweic I suspected this might be the issue as when I go into the source files for the middleware it only lists V1. When I go to the IBM Watson Assistant dashboard, I converted the bot to 'Classic Experience' Which seems to convert the bot to v1. However I still do not see a workspace ID listed when I click on a skill and select API details.

Do you currently have Watson working for botkit? Are you able to provide a guide?

Mattw11486 avatar Aug 12 '22 05:08 Mattw11486

Hi @Mattw11486 , while I still have Watson working for botkit, I am still using a Watson Assistant instance created a long time ago (when 'standard' was an option at the time of instance creation, which it has not been for a while now). Having said that, I plan to create a new instance in the next weeks for testing purposes. I'm not sure how soon I'll get to this though, but it's definitely in my plans. Then I'd be able to confirm (or hopefully not), what you're saying about the 'classic' experience and not being able to see the workspace id. However, in the meantime, I suggest you post in the Watson Community forum and try to get IBM to answer this. Since they claim that you should be able to use apis V1 and V2 side by side to each other, there has to be a way to obtain the workspace id that you need. If not, they would have to do something about it (which is why I think you should definitely post). There might be a simple answer to your question there actually (let's all hope so). Another thing: the kind of 'experience' you use in Watson should be independent of whether you can access APIs v1 or v2.

pgoldweic avatar Aug 12 '22 15:08 pgoldweic

Yeah I submitted a post on the Watson Community a few days ago but unfortunately no response back yet.

Mattw11486 avatar Aug 13 '22 10:08 Mattw11486

@Mattw11486 , I'm wondering if the response you got yesterday worked for you (from the community forum). Would be good to know. BTW, I also wanted to mention that I was able to create a new skill in the new classic experience (new Watson Assistant instance, lite plan) to which I imported a json file for a skill that I had working in my old instance - reduced to 100 intents-, and I was able to see the regular 'View Details' with the workspace id information once it was uploaded. I believe that I had not been able to see the API details - just like you reported- for new skills that I created before successfully importing the old skill. Then, after this successful import, all the skills I create appear to display the 'View Details'.

pgoldweic avatar Aug 16 '22 22:08 pgoldweic

I will try the steps tonight or whenever I get a chance to look at it. Been swamped at work this week. I might try downloading the json file and see if it provides what I need

Mattw11486 avatar Aug 18 '22 00:08 Mattw11486

Looks like its going to be a no go even with downloading the .json file I don't see a workspace ID and in skills view api details I just see a skill ID nothing of which works when trying to integrate it with the botkit middleware

Mattw11486 avatar Aug 18 '22 02:08 Mattw11486

skill id is what you need for integration @Mattw11486

pgoldweic avatar Aug 18 '22 13:08 pgoldweic

When I use the skill ID it gives me the 404 error still image

image

Mattw11486 avatar Aug 22 '22 01:08 Mattw11486

Hi @Mattw11486 , it's hard for me to understand the nature of the error you are describing. Perhaps if you share more of the stack trace that might help. BTW, I see that you are using Slack and I'm not familiar with using the Slack adapter (I've used the web adapter). I wonder if the error might be related to this adapter in particular? (I'm not seeing any mention of such adapter in the code you shared though).

pgoldweic avatar Aug 22 '22 02:08 pgoldweic

Here is the stack trace not sure if this provides any more clarity I also have the web adapter hooked up to this bot as well image

Mattw11486 avatar Oct 29 '22 04:10 Mattw11486

Just to clarify, you said you have the web adapter working for it too. Does it work? If so, this would be clearly a slack-adapter related problem then (which I'm afraid I can't say much about - hopefully others that work with it can help!). Also for my own understanding, you are now using the V1 API for Watson, and NOT using a Watson assistant instance, correct? (as you know by know, this middleware only works with V1, and this pretty much forces one not to use an actual Assistant instance but the skills directly to communicate with botkit)

pgoldweic avatar Oct 31 '22 14:10 pgoldweic

Strangely enough, I started completely from scratch and now it seems to be working! I don't know where exactly I went wrong as I tried so many different things. It may have been an issue with the URL even though I was using the same exact URL from the .env file in the example included within this repo. It of course still will not work for V2 and only works for the classic experience (V1) but that is okay.

Mattw11486 avatar Nov 05 '22 18:11 Mattw11486