Hosted Targets from Node.Js app to external servers Edge Micro

we are in process of migrating node js proxy to hosted target and one of the proxy calls microgateway as the back end is sap on premise. The problem that we are gettig a timeout. When we trace the problem the call come from localhost and edge micro does not accept. But with node js version the trace shows an ip address and accept the call.

Any idea how to resolve problem.

Solved Solved
0 13 621
1 ACCEPTED SOLUTION

Thank you the problem is firewall due to HT ip address we fixed the problem by passing through another proxy to get through EMG:

main_proxy(HT)----------> pass_through_proxy-------->EMG_proxy

View solution in original post

13 REPLIES 13

Hi Mohamed,

Could you elaborate a bit more as to what your architecture is?

Are you saying the proxy that is associated with the microgateway product is a hosted target and that's not working? Or that a hosted target sending requests to/from a microgateway proxy isn't working?

the hosted target node js proxy is sending the request to microgateway:

HostedTargetProxy----------->edgemicro_proxy(to access SAP on premise).

Hosted Targets can call anything, using nothing special. From your HT, make an HTTP call just like you would from anything else if you ran the Node.js yourself. HT is a vanilla, pure Node.js runtime.

the error i am getting is 504 Gateway timeout. when I do the console log to trace my code. It is the call to edgemicro is like not passing through.

with node js the call come from our edge cloud ip address, when I start the trace. It works fine. proxy responds

but with hosted target, it is from a localhost.

can be this the issue, and edgemicro not leting the call pass through?

I'm really having a hard time making sense of this. It looks like Edge to Hosted Target is fine but the call from Hosted Target to your backend (Edge Microgateway) fails? Is that correct? Do you have logging enabled to ensure the Hosted Target makes the request? Anything in front of your Edge Microgateway that is showing that the request is making it or not? I need more information.

I have a proxy: named customer_pac that has a target endpoint: HostedTarget. that have the node.js code.

in the runtime the axios call is sent but not going through to microgateway. her the console log:

{ "auth": { "username": "********", "password": "****************" }, "method": "post", "url": "http://dns_microgateway/sap", "headers": { "Content-Type": "text/xml" }, "data": "<?xml version=\"1.0\"?>\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">\n <soapenv:Header/>\n <soapenv:Body>\n <urn:ZvCustPacOrderGet>\n <IvLanguage>en-US</IvLanguage>\n <IvCustomerId/>\n <IvPacOrderId>d1394d0a-f36f-49b8-a00c-f2919deba386</IvPacOrderId>\n <IvSourceSystem>mohamed.ferchichi</IvSourceSystem>\n </urn:ZvCustPacOrderGet>\n </soapenv:Body>\n</soapenv:Envelope>", "params": { "language": "en-US" } }

Backend: calls edgemicro_customer_pac (targetendpoint: SAP service)

So is HT getting the request from Edge? If so, when the HT makes the Edge microgateway request, do you have any way to ensure that the request was made? Logging, access logs from anything servicing the HT->EMG request.

the call does not reach EMG:

I trace the call before and after migration:

before the migration (Targetendpoint: nodejs )

GET http://ipaddress/order_management/customer_pac_order/v1/order/d1394d0a-f36f-49b8-a00c-f2919deba386?l...

the call after the migration (Targetendpoint: HostedTargetd):

curl -X GET -H 'Accept: */*' -H 'Accept-Encoding: gzip,deflate,br' -H 'Accept-Language: en-US,en;q=0.9,fr;q=0.8' -H 'Apigehost: dev-cloud-api.brp.com' -H 'Authorization: *****' -H 'Cache-Control: no-cache' -H 'Devname: username' -H 'Postman-Token: e6a19437-dc2b-5fcc-9fbf-f7c92537fe4b' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'X-Forwarded-For: ipaddress' -H 'X-Forwarded-Port: 443' -H 'X-Forwarded-Proto: https' -H 'X-Postman-Interceptor-Id: 591ccd7a-4362-dd79-e207-f86f3f2e525a' 'http://localhost/order/d1394d0a-f36f-49b8-a00c-f2919deba386?language=en-US'

I'm asking if the Hosted Target backend is getting the request. You said EMG isn't getting the request but I want to know where to look. If HT isn't getting the request, that's one path but if it is, that's another path. Is the Node.js application running as a Hosted Target getting the request or not?

Yes Node.js application running as a Hosted Target is getting the request.

That's great news! Here are a few more questions, to hopefully quicken a fix:

  1. Are you sure the HT is making an external request? (Any chance I could see the code?)
  2. Where is your EMG running?
  3. Is the EMG getting the request?
  4. Is there anything between HT and EMG that can see the request coming in?
  5. Is there a chance this is a legitimate timeout where the time it takes for the HT to get a response from your EMG is taking a long time?

Thank you the problem is firewall due to HT ip address we fixed the problem by passing through another proxy to get through EMG:

main_proxy(HT)----------> pass_through_proxy-------->EMG_proxy

I'm glad you were able to get it sorted.