WebHook call failed. Error: DEADLINE_EXCEEDED, State: URL_TIMEOUT, Reason: TIMEOUT_WEB calling from node - node.js

I am not sure what mistake I am doing. I have create a ChatBot in google dialog flow and did setup of WebHook in my local. Once I am hitting from dialogbox then reuqest is landing to code and processed successfully but in Dialogflow response I am getting failure due to some TimOut exception, there a way to fix this . I am facing WebHook call failed. Error: DEADLINE_EXCEEDED, State: URL_TIMEOUT, Reason: TIMEOUT_WEB calling from node.
Below is the index.json snippet :
Below is the console log

At the end of the function you need to resolve the promise.
return Promise.resolve();
Additionally, you're probably already handling errors but in a Firebase Function, if you need to throw an error, you can do that simply this way:
throw new functions.https.HttpsError(
'internal',
'Woops, that should not happen.',
);

Related

Firebase Cloud Functions fail with no logs, just "Error: function terminated. Recommended action: inspect logs for termination reason"

I infrequently see this error in my Firebase Cloud Functions logs:
"Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging Request rejected.".
I looked through the logs around the time this error occurred and don't see any other information, just a few other successful executions of the same cloud function. The same function is executing successfully thousands of times a day, but then once every day or few hours this is shown. My entire cloud function body is wrapped in a try/catch and I've seen logical errors reported properly from the error log in the catch code so I don't know how this uncaught error is happening or how to get any more information about it. Does anyone know how this error could be happening? This is a sanitized version of the function throwing this weird error:
exports.onUserDocUpdate = functions.firestore
.document('user/{userId}/{collectionId}/{docId}')
.onWrite(handleDocumentWrite);
async function handleDocumentWrite(change, context) {
try {
// Function logic here
} catch (error) {
functions.logger.error(`firestoreTriggers.handleDocumentWrite failed with error:`, error);
}
}

#chatbase Error with not handled function in node mode

I am trying to connect my bot with chatbase.
For that I have generated the API key and connected it with after that I have set my intent with function sendChatbaseHandledMessage and sendChatbaseNotHandledMessage.
While I use sendChatbaseNotHandledMessage it gives this error:
The message cannot be set as not_handled and not be of type user.
at MessageStateWrapper.exportCreatePayload (/home/runner/node_modules/#google/chatbase/lib/MessageSink.js:426:14)
at Promise (/home/runner/node_modules/#google/chatbase/lib/MessageStateWrapper.js:145:29)
at new Promise (<anonymous>)
at MessageStateWrapper.send (/home/runner/node_modules/#google/chatbase/lib/MessageStateWrapper.js:141:12)
at sendChatbaseNotHandledMessage (evalmachine.<anonymous>:36:143)
at evalmachine.<anonymous>:39:3
at Script.runInContext (vm.js:74:29)
at Object.runInContext (vm.js:182:6)
at evaluate (/run_dir/repl.js:133:14)
at ReadStream.<anonymous> (/run_dir/repl.js:116:5)
As I can understand, the issue is with the chatbase node_modules with some library.
Can I get some solution for it?
Reposting the response from our engineer to the internal thread for reference.
It looks like the error is:
message cannot be set as not_handled and not be of type user
Not handled messages in the chatbase API can only by of type user so one would need to say:
var msg = chatbase.newMessage('my-api-key', 'my-user-id')
msg.setAsTypeUser().setAsNotHandled().send()...
In the chatbase API one cannot set agent messages as not handled, so the following is not allowed:
msg.setAsTypeAgent().setAsNotHandled()

Create PeerConnection exception: Failed to construct 'RTCPeerConnection': Malformed RTCIceServer

I am using appRTC to make demo app. I have setup following things successfully but got stack with JSON format that return in response of Turn-server API.
Use SSL for secure connect to make it work on Google Chrome (Done)
Implement custom WebSockets (Done)
Develop custom API for TurnServer (Done)
I am getting following error in console log.
Create PeerConnection exception: Failed to construct 'RTCPeerConnection': Malformed RTCIceServer
Failed to start signaling: Cannot read property 'addStream' of null
I have tried following responses as ice server object
Current object:
{"iceServers":[{"urls":["stun:stun.l.google.com:19302"]},{"urls":["turn:domain.com:8080?transport=udp","turn:domain.com:8080?transport=tcp","turn:domain.com:8080"],"username":"test","credential":"password"}],"lifetimeDuration":"86400s","blockStatus":"NOT_BLOCKED","iceTransportPolicy":"all"}
Have also tried:
[{"urls":["stun:stun.l.google.com:19302"]},{"urls":["turn:domain.com:8080?transport=udp","turn:domain.com:8080?transport=tcp","turn:domain.com:8080"],"username":"test","credential":"password"}]
and also tried this one:
[{"urls":["turn:domain.com:8080?transport=udp","turn:domain.com:8080?transport=tcp","turn:domain.com:8080"],"username":"test","credential":"password"}]
You have a typo here:
[{"urls":["stun:stun.l.google.com:19302"}
trying to close urls without closing the array.
This should be
[{"urls":["stun:stun.l.google.com:19302"]}
This doesn't result in an error about malformed RTCIceServer though.
Based on your comment it seems to be a result of calling
new RTCPeerConnection({"iceServers":[{}]})
-- an empty object is not a valid RTCIceServer.
I would also recommend not passing
"lifetimeDuration":"86400s","blockStatus":"NOT_BLOCKED"
to the RTCPeerConnection as it doesn't know about these.

Uncaught (in promise): Response with status: 0 in Angular2/Ionic2

I have linked my app into NodeJS server, after the get request goes(sucsses) I get an error on the app Uncaught (in promise): Response with status: 0 for URL: null.
This is the lastest branch of the app:
https://github.com/eshk12/Parabi/tree/DB-LINKED
And this is the NodeJS server:
https://github.com/eshk12/parabiNodeJS
I am talking about the function CreateMedicine() inside /Services/NetworkServices.ts.
The function CreateMedicine() goes to http://localhost:3000/Medicines/add/ with its GET parameters and insert them to the database.
but unknown error appear.
Hope you guys may help me fix it.
Thanks!
I believe that happens when the OPTIONS call fails. Most likely due to the service being unavailable.
OPTIONS http://localhost/api/login net::ERR_CONNECTION_REFUSED

NodeJS Azure Functions used as a Messenger Bot return an mscorlib error

I'm trying to use Azure Functions as a Messenger bot server using a Generic Webhook. The problem I'm running into is that even running this simple code (most of it is commented out to try & figure out the issue) results in an error (below the code):
module.exports = function (context, data) {
context.log('Webhook was triggered!');
context.res = {
status: 403,
body: ''
}
context.done();
}
Function completed (Failure,
Id=fb0f2178-8b98-4163-a5ae-7ab68eff47cd)
Exception while executing function: Functions.StriverMessenger.
mscorlib: The given key was not present in the dictionary.
Why is this error occurring and how do I get this to work? If I fake out the querystring entries in the run mode inside Azure, the function appears to work as coded. The error occurs when trying to send a Verify request to the Azure Function from Facebook Developer, specifically in Messenger's Webhook setup.
This happens when an empty (or non-json) body is sent to a Function with type WebHook. The handling is poor, and we are improving it per https://github.com/Azure/azure-webjobs-sdk-script/issues/849. This should be deployed within a week and you can then verify.

Resources