API config - connecting to local server


#1

Hi guys,

I am trying to connect my bot to an API located in local server instance.
Server is build on NodeJS and it’s URL that I connect is folllowing http://127.0.0.1:3333/auto
I am getting an error “Not found because of proxy error: Error: connect ECONNREFUSED 127.0.0.1:3333” on every type of request. Server is running as I can view it from the browser and call it using PostMan.

Kindly ask for you help with this.

Thanks and Cheers,
Piotr


#2

Hi @Katolus,

This might be happening because every API call from the ChatBot goes through a remote CORS proxy, which allows the API call to be made over Ajax, without having to configure the server to allow access for cross origin request.

In your case, when the server you are running is on a local machine, it cannot be called through this remote proxy.

So for this, do one thing. Add an extra field in the header of the API config called tarscorsproxy and set its value to no. Doing this will force the system to not use this CORS proxy and make the API call directly to the server. The config will look something like this:

download (50)

Try it out and let me know if it worked.


How to run an API which requires configuring and tunneling ports over SSH
#3

Hi @vinit,

Thanks for looking into my problem. It looks like it didn’t help. After this adjustment, I am getting a status 0 out of the call. I am assuming that is something you have implemented to stop user from using that option :slight_smile:.

Do you have any other ideas?

Cheers,
Piotr


#4

Ping me on live chat. Will take a look.


#5

Can you explain how can I ping you on live chat. I don’t see such an option on the chat building app. I am a new user. This is my result of implementing this http header.

Similar outcome from calling https://www.google.pl/, therefore I think that headers is invalid.

Still looking for a resolution.


#6

At the bottom right corner in the Dashboard:


#7

Solution: Thanks to @vinit I have managed to fix connnect my bot to a local nodeJS server (express based).

  1. Part include tarscorsproxy : no header in the API config request
  2. Enable CORS by adding middleware settings to your localy established server.

Thanks to that I am able to establish a connection.

image

Thanks for your help!


#8

Nice @Katolus . Glad to see it working :smiley: