cancel
Showing results for 
Search instead for 
Did you mean: 

error: getaddrinfo ENOTFOUND, cannot proxying to backend service via TCP/socks5 on BTP

wiking
Discoverer
0 Kudos

Hello guys,

I'm trying to access Postgres database service in our internal network, from the app deployed in Cloud Foundry, SAP BTP, using Connectivity service and SAP Cloud Connector(2.13.1).

My configuration is as below:

1) In Cloud Connector Admin UI

2) In BTP Cockpit, on Connectivity -> Cloud Connectors page

BTW, I also mapped several services with https/http protocol type(not list on the above screenshots), and these http(s) internal services are now all accessible from BTP app.

But the above DB service using TCP protocol, is still not inaccessible via Connectivity proxy. Details:

For authentication to Connectivity proxy, I followed the SAP BTP Connectivity guide on https://help.sap.com/products/CP_CONNECTIVITY/cca91383641e40ffbe03bdc78f00f681/cd1583775afa43f0bb9ec.... As my app uses Nodejs, so I use socks lib(https://github.com/JoshGlazebrook/socks) to create the socket to socks5 proxy server(connectivity service), and currently the custom_auth_response_handler function verifies the proxy authentication response code is successful. Then I use the created socket as Postgres connection pool's configuration, as below,

 {
          user: 'postgresuser',
          host: 'ta-portal-db',
          database: 'DEMODB',
          port: 5432,
          max: 700,
          connectionTimeoutMillis: 5000,
          idleTimeoutMillis: 30000,
          stream: Socket { ... }
}

Then, when query the database, it reports error:

Error: getaddrinfo ENOTFOUND ta-portal-db

at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)

So now, I've no idea where is wrong, and how to debug this proxy issue? Hope some guys with TCP/socks proxy and BTP connectivity service experience could help!

Thanks,

Wiking

sreehari_vpillai
Active Contributor
0 Kudos
Were you able to solve this ? I did the necessary code corrections to fetch credentials. After deployment , I get "Socket ended by BTP" . Any luck ?
View Entire Topic
gregorw
Active Contributor
0 Kudos

Hi Wiking,

please check out the issue SAP Cloud Connector support #100 that piejanssens created in the cds-pg project and his newly created sap-cf-socks project.

CU
Gregor

wiking
Discoverer
0 Kudos

Hi Gregor,

Thank you very much for your information.

I went though the references sap-cf-socks project and its usage in cds-pg, then found it is just the repo I refered just days before: https://github.com/piejanssens/btp-pg-socks (now is renamed to sap-cf-socks ), old version with usage sample is https://github.com/piejanssens/btp-pg-socks/tree/70c78f610431d824248a2a94146cb681056a1094 . So, I got still the same error using my above pool configuration.

I checked its usage in cds-pg, it uses localhost as the DB pool's host config( see https://github.com/piejanssens/cds-pg/blob/a07fb77693160243946c96dfdba658808eb1456d/lib/pg/Service.j...), I don't understand that.

And if my code switches to use localhost, gets error: SocksClientError: Proxy connection timed out ...

I will go further and try to contact the project author.

Thanks,

wiking