Timeout on request to backend after migrating from Trireme to Hosted Target

dev-3
Participant I

Hi,

Recently we've been working on migrating our existing node.js api from Trireme to a Hosted Target. While the logic changes are basic and we've verified that everything works just fine without Trireme container locally, there's an issue after deploying to newly created Hosted Target. The Authorization request sent to the backend that works both locally and on Trireme-deployed API, fails with ETIMEDOUT error.

Is there anything specific about the Trireme API that needs to be replicated in Hosted Target node application to make the outgoing requests look the same for the backend server?

Thanks!

Solved Solved
0 11 327
1 ACCEPTED SOLUTION

I'm sorry I didn't get the "localhost" mention above meant you were using IP whitelisting. But your assumption that the IP addresses to whitelist are not the same. Trireme IPs are the IP addresses of the Apigee Edge MPs while Hosted Target IPs are IP address pools corresponding with Google AppEngine as documented in the FAQ: https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-faq#can-i-use-ip-whitelisting-to-...

View solution in original post

11 REPLIES 11

`ETIMEOUT` seems like an error reported by Node.js, which would be the HT reaching out to whatever backend your Node.js application is reaching out to. So this means your HT is deployed and running fine, Apigee Edge can reach out to it just fine but whatever network I/O your HT is doing is timing out.

dev-3
Participant I

Hi, thank you - correct, I was trying to figure out why would the request to the same service from the Trireme API always work, and the request from HT would always timeout.

I now have these two APIs (HT and Trireme) exposed in test environment of my organization, and the only difference between them seems to be the base path - the IP looks to be the same, as is the proxy url.

So there's nothing on Trireme side that would need to be reimplemented in vanilla node (I'm thinking about some automatically applied security features etc.)? I just can't see the reason for the HT to fail, while I can make the same request from my local machine or from Trireme and see it work fine - that's why I'm pursuing the trireme vs HT path right now. Thanks again!

Node.js dictates the default timeout for HTTP server requests and responses. As for Trireme, there were also bugs where uncaught exceptions (like in this case) were never thrown. (We did fix this but had to roll it back due to the number of customers who had broken code.)

GitHub commits:

  1. Fix bug: https://github.com/apigee/trireme/commit/239d2ee9c845d77b9f75e8d72c1ee29e05f76822
  2. Make the bug configurable: https://github.com/apigee/trireme/commit/82f10a8bc2e101bae4c88cfea2e90d655b575300

The way Apigee Edge works now, the bug(s) are still there so as to keep customer code that previously worked on Trireme from failing due to fixing the bug(s).

dev-3
Participant I

Thanks again, I'm afraid it's not the case here though - the request gets resolved in trireme just fine within miliseconds, and the call made from HT script hangs for a minute before failing with the timeout, so unfortunately it has to be something else.

Thanks for the heads up. Does your backend use IP whitelisting to allow Apigee Edge MPs (Trireme) successfully access the backend?

dev-3
Participant I

It does, access from local is also restricted to a VPN - that's why I mentioned IP's before, which seem to be the same for both Trireme and HT instances. Is there a way to make sure in Edge panel somewhere?

I'm sorry I didn't get the "localhost" mention above meant you were using IP whitelisting. But your assumption that the IP addresses to whitelist are not the same. Trireme IPs are the IP addresses of the Apigee Edge MPs while Hosted Target IPs are IP address pools corresponding with Google AppEngine as documented in the FAQ: https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-faq#can-i-use-ip-whitelisting-to-...

dev-3
Participant I

Thank you! That makes a lot of sense, I'll try to follow this up with the backend providers and let you know if that was the case.

Hi @Multiplica Developmentt sorry to followup on this, but has this been resolved?

I am using Hosted Target, and trying to test the JS but it fails with 504 after sometime. However, my script totally works fine from my local terminal.

Thought my issue is something similar to yours. Please can you advise?


If you use IP whitelisting, it is something discussed in our FAQ. Chances are that certain HT servers hosts are not whitelisted. This is discussed in our FAQ: https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-faq#can-i-use-ip-whitelisting-to-...