How to get the remote ip address in Tower.js? - node.js

I'm creating web service, using Tower.js.
i was able to get the HTTP header and User-agent,but couldn't get a remote ip address.
how to get the remote ip address of requester?
I tried
looked for Tower.Controller class member variable and method (this.request and this.request.app and this.request.headers etc...)
check HTTP headers
read the tower-docs (https://github.com/viatropos/tower-docs)
read the superagent documents (https://github.com/visionmedia/superagent)
If there is lack of information, add.
thanks.

Thanks for your reply!
I'm checked request object.
but can't get IP address.
installed Tower 0.4.2-3 and Express 3.0.0rc5
but happen runtime error.
Is supported Express3.0 to Tower.js? Or Express 2.x can get remote ip address?
Could you please tell me.
Error message:
/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/mongodb/lib/mongodb/connection/server.js:432
throw err;
^
TypeError: Cannot call method 'apply' of undefined
at Tower.Application.Application.reopen.use (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-application/server/application.js:115:52)
at null. (/var/www/html/melissa/server2/node_modules/tower/bin/test/app/config/server/bootstrap.coffee:9:12)
at Tower.Application.Application.reopen.stack (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-application/server/application.js:177:16)
at Tower.Application.Application.reopen.initialize.initializer (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-application/server/application.js:90:19)
at Tower.Application.Application.reopen.configureStores (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-application/server/application.js:164:27)
at _.extend.parallel (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-support/shared/shared.js:344:20)
at /var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-store/server/mongodb/database.js:52:24
at applyIndexes (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-store/server/mongodb/database.js:26:20)
at /var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/tower/lib/tower-store/server/mongodb/database.js:50:20
at Db.open (/var/www/html/melissa/server2/node_modules/tower/bin/test/node_modules/mongodb/lib/mongodb/db.js:258:14)

Related

Docusign: HTTPS required for Connect listener communication error

I'm trying to use the Docusign API for an application that I'm running locally and I see the following error:
"message":"Uncaught Error when executing a Single
Cause: com.docusign.esign.client.ApiException: Error while
requesting server, received a non successful HTTP code 400 with response Body:
'{"errorCode":"HTTPS_REQUIRED_FOR_CONNECT_LISTENER",
"message":"HTTPS required for Connect listener communication."}'
Description: com.docusign.esign.client.ApiException: Error while
requesting server, received a non successful HTTP code 400 with response Body:
'{"errorCode":"HTTPS_REQUIRED_FOR_CONNECT_LISTENER",
"message":"HTTPS required for Connect listener communication."}
I am behind a company proxy but I have been able to use the API in the past and create envelopes without an issue so I'm not sure how to address this. Any help would be greatly appreciated.
This change is discussed in the Jan release notes.
Connect can only be used with https listeners (customers' servers).
And note that the server must use a certificate that chains to a root cert in the Microsoft standard root cert list. (Self-signed certs won't work.) You can use a free cert from LetsEncrypt or a $15 cert from a reputable CA.
I'm sorry that this update caught you by surprise.
Getting error now, it was working fine before:
Fatal error: Uncaught DocuSign\eSign\Client\ApiException: Error while requesting server, received a non successful HTTP code [400] with response Body: O:8:"stdClass":2:{s:9:"errorCode";s:35:"HTTPS_REQUIRED_FOR_CONNECT_LISTENER";s:7:"message";s:50:"HTTPS required for Connect listener communication.";}

Cannot read property 'addEventListener' of undefined in AWS CHIME

I am trying to run the AWS CHIME demo project locally. it is working fine if I doesn't change the const host ="127.0.0.1:8080" in the server.js file. But when changing the host to local IP to virtualization of host it throws an error after
the error showed to me
Unable to find meeting
There was an issue finding that meeting.
The meeting may have already ended, or your authorization may have expired.
Cannot read property 'addEventListener' of undefined

Message: Error: NameResolutionFailure when using the getstream SDK

I got the exception "Message: Error: NameResolutionFailure" when calling the getstream sdk on Xamarin.iOS app.
This does not happen all the time , but it happens quite often.
Please check this link for the detail error message of the exception
Following is the code where the exception happens
var userFeed = client.Feed("timeline", "id");
var activities = await userFeed.GetActivities(0, 15);
Is there anyway to resolve this issue? Please help
The error suggests that the OS is unable to resolve the DNS correctly. The most common cause for this is bad ISP DNS servers.
The simplest solution is to pick Google or Cloudflare DNS and configure your network (ie. your router DHCP settings or similar) to use them.
Google DNS: 8.8.8.8 and 8.8.4.4
Cloudflare DNS: 1.1.1.1

Google Cloud API Environment Credentials on Node.js on Phusion Passenger server

I have the translation client library set up on my Windows home Node.js server and use set GOOGLE_APPLICATION_CREDENTIALS=[PATH] to instantiate the credentials when I start the machine. This works fine.
On the publicly hosted server I don't think the request gets as far as asking for credentials because a different error is thrown than the one saying The request is missing a valid API key. This would appear I forgot to set the credentials or defined the path incorrectly.
I've tried many variations of export GOOGLE_APPLICATION_CREDENTIALS="[PATH]" but the error I keep getting is:
UnhandledPromiseRejectionWarning: Error: Unexpected error determining execution environment: Unsuccessful response status code. Request failed with status code 404
at GoogleAuth.<anonymous> (/usr/home/.../public_nodejs/node_modules/google-auth-library/build/src/auth/googleauth.js:163:23)
at Generator.throw (<anonymous>)
at rejected (/usr/home/.../public_nodejs/node_modules/google-auth-library/build/src/auth/googleauth.js:20:65)
at process._tickCallback (internal/process/next_tick.js:68:7)
I think this is to do with setting the environment variable in Phusion Passenger, but it's odd to me that the error I get is different.

Error reaching the Node.js server in drupal 7

I have installed node.js server on shared hosting.I have drupal site in which I am using node.js integration module to connect to node.js server.
But whenever I am trying to broadcast message from admin panel, I am getting this error message "Error reaching the Node.js server "Error reaching the Node.js server at "nodejs/publish" with {"data":{"somecustomdata":"http://www.google.ca"},"channel":"nodejs_user_1","callback":"myowncallback","clientSocketId":""} "%{"data":{"somecustomdata":"http://www.google.ca"},"channel":"nodejs_user_1","callback":"myowncallback","clientSocketId":""}": [404] Not Found." in db log.
Any help would be appreciated.
It is very likely one of two things:
Drupal server is accessing wrong URI.
Node.js Server is not listening to the URI you expect it to.
Of course something less obvious might cause errors, but please verify those two before proceeding.
Best would be to get your Drupal server print in error logs the URI it is trying to access, and manually verify you can access it within your browser, or another tool.
Thanks "alandrev" for your help.I have resolved that issue on the same day but I forgot to add my mistake.Actually I was not configuring the nodejs correctly.I was using the incorrect port number on backend settings in nodejs.config.js file.The correct settings mentioned below:
backendSettings = {
"scheme":"https",
"host":"yourhostname",
"port":"port number which is not already in use",
'sslKeyPath': 'key file path for ssl enabled site otherwise leave empty',
'sslCertPath': 'certificate path for ssl enabled site otherwise leave empty',
'sslCAPath': '',
"resource":"/socket.io",
"baseAuthPath": '/nodejs/',
"publishUrl":"publish",
"serviceKey":"",
"backend":{
"port":443,
"scheme": 'https or http',
"host":"yourhostname",
"messagePath":"/nodejs/message/"},
"clientsCanWriteToChannels":false,
"clientsCanWriteToClients":false,
"extensions":"",
"debug":false,
"addUserToChannelUrl": 'user/channel/add/:channel/:uid',
"publishMessageToContentChannelUrl": 'content/token/message',
"jsMinification":true,
"jsEtag":true,
"logLevel":1};
Solved this same issue by adding "polling" to the transport
backendSettings = {
"scheme":"http",
"host":"localhost",
"port":8081,
"key":"/path/to/key/file",
"cert":"/path/to/cert/file",
"resource":"/socket.io",
"publishUrl":"publish",
"serviceKey":"SERVICE KEY",
"backend":{
"port":80,
"host":"localhost",
"messagePath":"/mysite/nodejs/message/"},
"clientsCanWriteToChannels":true,
"clientsCanWriteToClients":true,
"extensions":"",
"debug":true,
"transports":["websocket","polling",
"flashsocket",
"htmlfile",
"xhr-polling",
"jsonp-polling"],
"jsMinification":true,
"jsEtag":true,
"logLevel":1};

Resources