cancel
Showing results for 
Search instead for 
Did you mean: 

CORS Issue between NEO and CAI

Phani_Kumar
Participant
0 Kudos

Hello Experts,

UI5 Application is deployed and running fine in all environments with Chatbot integrated in it. Even the chat bot is working fine. Application is running in NEO environment.

All of a sudden, we noticed CORS issue in the Application and I am not sure what needs to be done. UI5 Application is working fine even now but CORS issue is coming for Chat Bot .

Do we need to add any setting at CAI Layer or at the UI5 Application or at the Neo environment layer?

We have used an Ajax call to connect to Chat bot. Please let us know how can we over come this issue?

View Entire Topic
former_member540067
Active Participant
0 Kudos

Hi

Use destination in neo environment and consume that, rather than direct ajax call

regards

Anmol

Phani_Kumar
Participant
0 Kudos

Thanks anmolchadha111 ,

If that is some back end service, I would have done that. But I don't know how to create destination for ChatBots?

Can we create destinations for chatbot as wel?

former_member540067
Active Participant
0 Kudos

Hi Pawan,

If you are making an Ajax call, i am pretty sure you would be calling some URL. Use that URL in destination. Or post the ajax call snippet here i can see.

Regards

Anmol

Phani_Kumar
Participant
0 Kudos


URL can be hard coded to - 'https://api.cai.tools.sap/train/v2/request' but some times we connect to one bot and 
some times we connect to different bot by changing the Requesting TOKEN Key... (Kind of Dynamic). But I will be 
happy at least if I understand the way to do it. Not sure if we create destination what should be authentication mechanism


Do we need to create oAuth tokens in chatbot and use them?

<img alt="" style="font-family: Arial, Helvetica, Verdana, Tahoma, sans-serif; font-size: 15px; white-space: normal; color: inherit;">
former_member540067
Active Participant
0 Kudos

I believe you would be having multiple, but limited number of different urls, where the hostname would be fixed like xxxxx.xxxx.com

Try creating destination as of basic host url and consume it.

I am not sure about authentication method. You need to give it a try. I haven't worked on chat bots yet. 🙂

Phani_Kumar
Participant
0 Kudos

Hi harinder.singh.batra

Do you have any idea how to do this. Can you please let me know how can I overcome this CORS issue.

nicoschoenteich
Developer Advocate
Developer Advocate
0 Kudos

Hi Pawan,

you can check the UI5 documentation to see how to create a destination in your neo-app.json file.

Additionally you will have to create a destination in the cockpit.

Please note that the "name" in the cockpit has to match the name in the neo-app.json. The "path" in the neo-app.json is what you then call in your AJAX call and what you attach the rest of your URL to. The actual call to the complete URL will then be made server side on your behalf (avoiding CORS).

An example:

neo-app.json:

... 
{ 
  "path": "/routeMeToCAIDest/",
  "target": {
    "type": "destination",
    "name": "myCAIDest"
  },
  "description": "My destination to CAI"
}
...

Destination in the cockpit:

Configure it so that the URL is "https://api.cai.tools.sap" and the name is "myCAIDest"

AJAX call:

...
url: "routeMeToCAIDest/train/v2/request"
...