Azure - nodejs serverless function throwing error Error: 13 INTERNAL: Failed to parse server response - node.js

I am getting the below expeception, my node serverless function is throwing exception however many time it works correctly, when I check failed request, these exceptions are found.
Exception while executing function: Functions.createParticipantUserEntry node exited with code 1
at Object.module.exports.exports.createStatusError (/azure-functions-host/workers/node/worker-bundle.js:980:15),
details: 'Failed to parse server response',LanguageWorkerConsoleLog[error]
Worker 78afd559-7c19-4b0d-9a60-9a3039049fe2 uncaught exception: Error: Error: 13 INTERNAL: Failed to parse server response
at ClientDuplexStream.<anonymous> (/azure-functions-host/workers/node/worker-bundle.js:18483:19)
at ClientDuplexStream.emit (events.js:400:28)
at ClientDuplexStream._emitStatusIfDone (/azure-functions-host/workers/node/worker-bundle.js:7691:12)
at ClientDuplexStream._receiveStatus (/azure-functions-host/workers/node/worker-bundle.js:7668:8)
at Object.onReceiveStatus (/azure-functions-host/workers/node/worker-bundle.js:23065:15)
at InterceptingListener.module.exports.InterceptingListener._callNext (/azure-functions-host/workers/node/worker-bundle.js:22322:42)
at InterceptingListener.module.exports.InterceptingListener.onReceiveStatus (/azure-functions-host/workers/node/worker-bundle.js:22372:8)
at /azure-functions-host/workers/node/worker-bundle.js:22881:18
This issue is different than Error: 14, this one is Error 13 which is related to the response while Error 14 is related to connection to the azure portal from VS Code.

Related

Error: An API error occurred: account_inactive

I tried running npm start but I'm getting this error:
> nescafe#1.0.0 start
> node app
proce: xoxb-2520645612-695846949413-JiOgrqHAMjNk5u2xBl6PZMV3
proce: b2a94e46944f576fa11073dac5368e8f
[INFO] socket-mode:SocketModeClient:0 Going to establish a new connection to Slack ...
⚡️ Bolt app is running!
/home/kr/Workspace/nescafe/node_modules/#slack/web-api/dist/errors.js:56
const error = errorWithCode(new Error(`An API error occurred: ${result.error}`), ErrorCode.PlatformError);
^
Error: An API error occurred: account_inactive
at platformErrorFromResult (/home/kr/Workspace/nescafe/node_modules/#slack/web-api/dist/errors.js:56:33)
at WebClient.apiCall (/home/kr/Workspace/nescafe/node_modules/#slack/web-api/dist/WebClient.js:181:56)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'slack_webapi_platform_error',
data: { ok: false, error: 'account_inactive', response_metadata: {} }
}
How do I resolve it? I already checked my tokens and they are correct.
The app also runs when I try running it on another laptop. I also tried calling the auth.test as suggested in another stackoverflow question, but it didn't work.
You should not post your token here on Stack Overflow, as it can be used maliciously.
The account_inactive error happens when using a bot token and the bot is uninstalled, or when the token is for a deleted user or workspace. If you reinstall your app, you should receive a new token and that should work.

How can I fix this 'Unable to connect to the Parse API' error

Unhandled Runtime Error
Error: XMLHttpRequest failed: "Unable to connect to the Parse API"
Call Stack
handleError
node_modules\moralis\lib\browser\RESTController.js (445:0)
Check if your server is active/online in the admin dashboard.

how do I handle Name resolution failed for target firestore.googleapis.com:443 code: 14

How and where do I handle this error and stop my app from crashing ?
$ node app.js
Server Started at port 3000
events.js:200
throw er; // Unhandled 'error' event
^
Error: 14 UNAVAILABLE: Name resolution failed for target firestore.googleapis.com:443
at Object.callErrorFromStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call.js:30:26)
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client.js:327:49)
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client-interceptors.js:303:181)
at Http2CallStream.outputStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:114:27)
at Http2CallStream.maybeOutputStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:153:22)
at Http2CallStream.endCall (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:140:18)
at Http2CallStream.cancelWithStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:441:14)
at ChannelImplementation.tryPick (D:\food_list\node_modules\#grpc\grpc-js\build\src\channel.js:214:32)
at ChannelImplementation._startCallStream (D:\food_list\node_modules\#grpc\grpc-js\build\src\channel.js:244:14)
at Http2CallStream.start (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:418:22)
Emitted 'error' event on ClientReadableStreamImpl instance at:
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client.js:327:28)
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client-interceptors.js:303:181)
[... lines matching original stack trace ...]
at Http2CallStream.start (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:418:22)
at BaseStreamingInterceptingCall.start (D:\food_list\node_modules\#grpc\grpc-js\build\src\client-interceptors.js:275:19) { code: 14,
details: 'Name resolution failed for target firestore.googleapis.com:443',
metadata: Metadata { internalRepr: Map {}, options: {} }
}
ps: The app crashes when I run the app without internet.
This is a DNS error. DNS is a service that's used in internet connections. Your app is trying to access the internet, Firestore specifically, but cannot. That's why there's an error. There's no simple fix to this, as you would have to also program behavior for the app to function while offline.
The error stack trace says this:
Emitted 'error' event on ClientReadableStreamImpl instance at:
This means that the error is being thrown because the stream is emitting an error event and you are not handling that event. You can fix that by calling stream.on('error', callback) on the stream that you are reading from.

Dialogflow NodeJS library issue

I'm working on a dialogflow POC where I'm trying to invoke the v2 API provided by DialogFlow. While trying the NodeJS code example provided here, I'm getting the below error
{ Error: EHOSTUNREACH undefined: Getting metadata from plugin failed with error: request to https://www.googleapis.com/oauth2/v4/token failed, reason: connect EHOSTUNREACH 0.0.38.172:80 - Local (192.168.0.103:51468)
at Object.callErrorFromStatus (/Users/devuser/Development/workspaces/df-poc/node_modules/#grpc/grpc-js/build/src/call.js:30:26)
at Http2CallStream.call.on (/Users/devuser/Development/workspaces/df-poc/node_modules/#grpc/grpc-js/build/src/client.js:96:33)
at Http2CallStream.emit (events.js:203:15)
at process.nextTick (/Users/devuser/Development/workspaces/df-poc/node_modules/#grpc/grpc-js/build/src/call-stream.js:75:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
code: 'EHOSTUNREACH',
details:
'Getting metadata from plugin failed with error: request to https://www.googleapis.com/oauth2/v4/token failed, reason: connect EHOSTUNREACH 0.0.38.172:80 - Local (192.168.0.103:51468)',
metadata: Metadata { internalRepr: Map {}, options: {} } }
I have imported GOOGLE_APPLICATION_CREDENTIALS and point the environment variable to the credentials. The invocation works fine if I try the REST API route with the Authorization header.
Kindly let me know if there is something which I'm missing here.
This means EHOST (the remote host of the files you are requesting) are unreachable. They are either down, or your computer cannot access them due to some other restriction, such as location, which can be solved with a VPN.

Parse Server + Express - Issues with ParseError and site dying/restarting

I have deployed a Bitnami Parse stack to a Google Cloud VM. This stack is basically Apache running as a proxy, Then a MEAN stack handling parse server and dashboard etc.
Everything appears to be working fine when accessing the dashboard and sending individual CURL requests to test it's all available.
However, there appears to be a fatal flaw in that. When Parse returns one of it's errors e.g.
{"code":101,"error":"Object not found."}
Express sees it as an uncaught exception and dies. Now I realise that it's intentional behaviour (There's enough information out there as to why you don't want to persist after an uncaught exception)
The Bitnami stack uses Forever to run the Parse Server, but as you can see from the logs I will include below, you still run into issues with refused connections.
2016-11-25T11:41:16+00:00 DEBUG (7): {"code":101,"error":"Object not found."}
2016-11-25T11:41:16+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
2016-11-25T11:41:17+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
2016-11-25T11:41:17+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
2016-11-25T11:41:17+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
Meanwhile in the Forever logs:
Error generating response. ParseError { code: 101, message: 'Object not found.' } code=101, message=Object not found.
[object Object]
/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/lib/ParseServer.js:425
throw err;
^
Error: EACCES: permission denied, open '/opt/bitnami/apps/parse/htdocs/logs/parse-server.info.2016-11-25'
at Error (native)
error: Forever detected script exited with code: 7
error: Script restart attempt #1
parse-server running on port 1337
parse-dashboard running on port 4040
So you can see that immediately following a Parse error being returned, The service is unavailable until Forever can restart the Parse Server.
This issue appears that it would affect all users as well, so if one user receives an exception, all users lose connection for a brief period.
So the question is, how should this be properly handled? Is Parse + Express not the way to go about it? Or is there some method of configuring Node or Express to return the API error to the requester, without Express dying (And without having to fall into the trap of using uncaughtException to keep Node alive)
Any help would be much appreciated, thank you
The logs from Forever said it's EACCES error, that means ParseServer couldn't access the log file and not able to write the info log in it.
Error: EACCES: permission denied, open '/opt/bitnami/apps/parse/htdocs/logs/parse-server.info.2016-11-25'
at Error (native)
error: Forever detected script exited with code: 7
error: Script restart attempt #1
parse-server running on port 1337
parse-dashboard running on port 4040
I think you have to change the /opt/bitnami/apps/parse/htdocs/logs with proper permission so that ParseServer can write log files in it.

Resources