Connection issue with chat bot deployed on AWS - node.js

I have deployed a Node.js bot (code from Github sample) on AWS and have configured CosmosDB on Azure. I also have configured ports to allow all incoming and outgoing traffic on AWS.
Now, if I run the node server on local and use emulator to communicate, I receive messages from the server. If I use node server running on AWS to connect, I get an error as attached:
On emulator I see this - Error: The bot is remote, but the callback URL is localhost. Without tunneling software you will not receive replies.Connecting to bots hosted remotely
How do I resolve this? Do I need to install ngrok on EC2 machine as well?
Update 1: I have installed ngrok on local machine where I am running emulator.

Related

Access local services from firebase cloud functions emulator (ECONNREFUSED connecting to localhost)

Obviously Firebase Cloud Functions cannot access http services on localhost, once deployed (as per this answer). However, is there a way to test local http services when running the cloud functions emulator locally?
I have a node.js app and various firebase emulators running in docker containers (with docker-compose), all using different ports. I need my cloud function to send a POST request to the node app, and I'd like to test this all on my local machine.
The cloud function (hosted at http://0.0.0.0:3318) gets an ECONNREFUSED error when I attempt to post a request to my node app (at http://localhost:2018) using axios.
Using the magic of docker-compose networking, I found I could connect to my node.js service (named api in my docker-compose.yml) from my emulated function simply using the url http://api:2018

InactiveRpcError when trying to connect to Google Cloud Run rpc service

I currently have a gRPC server running on a google cloud run instance that built and deployed successfully. When I run and connect my client to it locally, it works fine. However, when I deploy it to google cloud run and attempt to connect to the resulting URL it gives me an InactiveRpcError and a "DNS Resolution failed for service" report. Nothing appears wrong on the google cloud console, but none of the requests are showing up either. What is happening here?
If you are connecting from a secure channel to your GRPC server,
you will need to specify the Cloud Run service URL without https://and by specifying the port 443 as following:
with grpc.secure_channel(
'<app-url>-uc.a.run.app:443',
grpc.ssl_channel_credentials(),
) as channel:
stub = my_service_pb2_grpc.MyServiceStub(channel)
request = my_service_pb2.MyEndpointRequest(
test='hello'
)
response = stub.MyEndpoint(request)
print(response)

Bot Framework Emulator Error: POST 500 directline postActivity

I am trying to connect Microsoft Bot Emulator to my remote bot in Azure.
When I run my bot locally it works as expected however when I set a new configuration to connect to "Web app bot" in Azure I get error as below
[16:05:17]Error: The bot is remote, but the service URL is localhost.
Without tunneling software you will not receive replies.
[16:05:17]Connecting to bots hosted remotely
[16:05:17]Edit ngrok settings
[16:05:17]->messagehi
[16:05:17] POST 500 directline.postActivity
I have tried different options in ngrok setting and followed this post (Bot Emulator gets POST 500 directline.postActivity). However, I am still getting the error. Below is the log details in emulator inspector-json.
"{\r\n \"message\": \"An error has occurred.\",\r\n \"exceptionMessage\":
\"An error occurred while sending the request.\",\r\n \"exceptionType\":
\"System.Net.Http.HttpRequestException\",\r\n \"stackTrace\": \" at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task <>c__DisplayClass11_0.<<SendAsync>b__1>d.MoveNext()\\r\\n--- End of stack
trace from previous location where exception was thrown ---\\r\\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)\\r\\n
Expected:
how to connect with the remote bot setting a endpoint in bot framework emulator?
where to find the "**Azure Bot Service Configuration details as in the image below"?
You can’t use the Azure supplied messaging endpoint for your bot (“xxxxxx.azurewebsites.ner/api/messages “) in Emulator. Emulator is meant for testing your locally stored bot. However, you can connect your local bot via an ngrok tunnel to your Azure hosted bot to access external services and channels. This allows you to test your code before publishing your bot to Azure.
First, use ngrok to create a tunnel (you can change the port, as needed). To create that tunnel, run this cli command:
ngrok http 3978 -host-header="localhost:3978"
This will produce a forwarding (i.e. tunneling) address that will look something like this:
https://h8g56dq.ngrok.io
Copy the “https” address.
Next, replace the messaging endpoint in your Azure hosted bot using the above address with “api/messages” appended to it. It should look like this once entered:
https://h8g56dg.ngrok.io/api/messages
In Emulator, set the address to the above. Enter your AppId and AppPassword, as well, or you will receive a 401 Unauthorized status code.
At this point, with your local bot running, you will be able connect via Emulator.
Hope of help!

Node-RED installed on Google Cloud Platform, but "Error: Lost connection to server"

I installed and deploy Node-RED on Google Cloud Console by using Node.js on Google Cloud Platform.
Then I can see the display of Node-RED, control nodes, and deploy. But always display "Error: Lost connection to server", and not work properly.
In the case of Bluemix, it can work by connecting on https, but cannot work on https.
Does anyone have any ideas?
Google App Engine doesn't support websockets over secure connection at the moment, if you still want it to work over google cloud platform, you will need to change the node red to open its websocket connection directly to the machine external ip and use it over http connection only

ServiceStack site cannot be run with Azure emulator

I have hello world webservice from here https://github.com/ServiceStack/ServiceStack/wiki/Create-your-first-webservice and it runs as a website without any problem.
But if I add this website as Webrole to Cloud Solution and try to run it in Dev Fabric emulator I'm getting error:
[Fiddler] The socket connection to 127.0.0.1 failed.
ErrorCode: 10061.
No connection could be made because the target machine actively refused it 127.0.0.1:82
I guess this happens because of compute emulator setup. It accept requests on 127.0.0.1:8X and then redirect to IIS(or IIS express) on 127.255.0.0:8X. Probably in this scenario ServiceStack routing misbehave.
Any workaround available?

Resources