InactiveRpcError when trying to connect to Google Cloud Run rpc service - python-3.x

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)

Related

nodejs windows service shows as running but is not responding

I am using the node-windows module to serve my API as a service on a VM windows server. the service was running fine but after this weekend I had no response from the API and no errors in the app that is calling the API.
When I checked the server the API service is showing as running, I restarted the service and all is good now.
Does anyone know why this is or how can I troubleshoot (get more info ) about what was happening?
Thanks

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

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!

Connection issue with chat bot deployed on AWS

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.

IBM API Connect apps published to Bluemix inaccessible

I followed API Connect getting started guide to create a local loopback API app and tested successfully. Then I am trying to follow Publish Your API to Bluemix. The publishing is successful. The app is running. But clicking the app yields Chrome error:
This site can’t provide a secure connection
ddd.abbr-dev2.apic.mybluemix.net sent an invalid response.
I suspect the problem is incorrect port. According to CloudFoundry Nodejs tips, the port should use process.env.PORT, but loopback defaults to 3000. Following this clue, I tried adding config.local.js:
module.exports = {
port: process.env.PORT
};
But the service end point is still inaccessible.
Please Help. Thanks
This is actually by design. Since your API's implementation is on the public internet, it is secured via Mutual TLS. The only way to access it is via the API Connect gateway, thus ensuring the API is managed.
If you want to make it accessible publicly, open the app in the Bluemix console and add an additional route to the app, using the mybluemix.net domain.

Resources