Dialogflow NodeJS library issue - dialogflow-es

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.

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.

aws-serverless-express connection error - socket hangup

I have a lambda function accessed via API gateway. The function receives username and password and performs authentication on a given active directory.
If the user is found then it calls the database to fetch the user by username > generates JWT and returns it in the response.
For last few days I have been getting CORS errors on the login page. On further inspection of the CloudWatch logs I see these errors
{
"errno": "ETIMEDOUT",
"code": "ETIMEDOUT",
"syscall": "connect",
"address": "10.1.2.39",
"port": 389
}
error.code Error: connect ETIMEDOUT 10.1.2.39:389
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
{ errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '10.1.2.39', port: 389}
ERROR: aws-serverless-express connection error
ERROR Error: socket hang up
at connResetException (internal/errors.js:609:14)
at Socket.socketOnEnd (_http_client.js:458:23)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) { code: 'ECONNRESET'}
The weird thing is, when I try to log into the application for the first time, I get these errors, but let's say I wait for some 15-20 minutes and then try logging again, no error appears and I am logged in smoothly.
The AD is maintained by the customer and they claim nothing is wrong on their end. This issue started happening recently even though the application has been in production for the last six months.
I am using the activedirectory module for AD authentication. If I run a simple authenticate code locally with the same username and password then it works so there is no problem with AD authentication or the credentials.
I am using Node 12 in my lambda. Also I am using aws-serverless-koa and not express so I am assuming that the error is coming from some dependency (probably activedirectory).

GRPC - nodejs DNS resolution failed

I'm working with a GRPC service hosted with HTTPS and self-signed cert. When I connect using syntax like:
const client = new productService('https://grpc-server-xxx.com:9090',
grpc.credentials.createInsecure())
I am getting the error like this
{ Error: 14 UNAVAILABLE: DNS resolution failed
at Object.exports.createStatusError (C:\grpc\node_modules\grpc\src\common.js:91:15)
at Object.onReceiveStatus (C:\grpc\node_modules\grpc\src\client_interceptors.js:1209:28)
at InterceptingListener._callNext (C:\grpc\node_modules\grpc\src\client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (C:\grpc\node_modules\grpc\src\client_interceptors.js:618:8) at callback (C:\grpc\node_modules\grpc\src\client_interceptors.js:847:24)code: 14,metadata: Metadata { _internal_repr: {}, flags: 0 },details: 'DNS resolution failed'
Anyone help me how can I resolve the issue.
Note:
My OS is Windows 10,
nodejs -- v10.16.0,
GRPC
The gRPC library does not recognize the https:// scheme for addresses, so that target name will cause it to try to resolve the wrong name. You should instead use grpc-server-xxx.com:9090 or dns:grpc-server-xxx.com:9090 or dns:///grpc-server-xxx.com:9090. More detailed information about how gRPC interprets channel target names can be found in this documentation page.
Noob mistake, but I did it.
Make sure your IP address is 0.0.0.0:9090 and not 0.0.0.0.9090

Nodejs Error "EPROTO" when using GitHub Webhook to forward to Jenkins using dockerimage

I'm using a jenkins server behind a firewall. I used smee-client smee.io to get the webhooks from GitHub through the firewall.
I used the dockerimage from deltaprojects/smee-client. It is running and connects to smee.io/xyz to get the webhooks. But if GitHub sending a webhook (configured sending it to smee.io/xyz) it was successfull with a 200 Response.
But the smee-client ist throwing some EPROTO Errors from nodejs. (see output below)
Config Github webhook:
Payload url https://smee.io/xyz
Content type application/json
Enable SSL verification
* Send me everything
[*] active
Webhooks seems to work and get a 200 HTML Response
The smee-client is showing the following Error:
{ Error: write EPROTO 140483050982248:error:1408F10B:SSL
routines:ssl3_get_record:wrong version
number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
at WriteWrap.afterWrite [as oncomplete] (net.js:788:14)
errno: 'EPROTO',
code: 'EPROTO',
syscall: 'write',
response: undefined }
{ Error: write EPROTO 140483050982248:error:1408F10B:SSL
routines:ssl3_get_record:wrong version
number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
at WriteWrap.afterWrite [as oncomplete] (net.js:788:14)
errno: 'EPROTO',
code: 'EPROTO',
syscall: 'write',
response: undefined }
I tried to build the image myself but with the same result in Error massage.
I'm not that fammiliar with ssl certificates or even if this problem is related to ssl.
Maybe someone faced this problem as well and know a hint what i'm doing wrong? That would be really nice
Got solved by forwarding from smee-client to jenkins with http:// instead of https://
This Error message was kind of misleading

how to push data into mongodb using sparkfun phant?

I am new to phant and i cannot find a suitable documentation on phant using mongodb. because i have lots of data and it memory overflow occurs. and finally i fell into following error:
HTTP output: { [Error: EMFILE, open 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv']
errno: -24,
code: 'EMFILE',
path: 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv' }
events.js:87
throw Error('Uncaught, unspecified "error" event.');
^
Error: Uncaught, unspecified "error" event.
at Error (native)
at Function.emit (events.js:87:13)
at Function.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-manager-http/index.js:237:12)
at PhantMeta.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/lib/phant-meta-nedb.js:243:14)
at callback (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/executor.js:30:17)
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/datastore.js:536:25
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/persistence.js:201:12
at fs.js:1077:21
at FSReqWrap.oncomplete (fs.js:95:15)
except this sometimes following error also occurs:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
thats why i want to use mongodb to prevent this error. i searched about this and finally found sparckfun library for mongodb:
https://github.com/sparkfun/phant-stream-mongodb
i installed this but nothing happened as data still not string into mongo.
so, How will i store phant data into mongodb ?
I had the same problem, specifically trying to deploy my own Phant instance on Heroku (since I wanted to circumvent Sparkfun's 50Mb limit). After some dabbling with versions of the mongodb and mongoose libraries, I successfully forked and modified their repository so that you can either run it locally or directly deploy on heroku (just make sure you provision a MongoLab add-on). Check out my fork here: https://github.com/davidlago/phant
Hope this helps!

Resources