502 Error in establishing connection issue

Hi Team,

I am Facing 502 Errors in establishing a connection when I make an API request to a third-party server.

but I get a successful response in the same API request using postman. could you share the suggestion to fix the issue?

also attached is an issue screenshot

Thanks in advance:slightly_smiling_face:

Hi @hemakumar, are you seeing this error in local simulation when using fdk run or in production? Does the external API use standard HTTP port 443, or is it on a custom port? If it is in local simulation, can you share what FDK version you are on?

Hi @kaustavdm

Thanks for the reply, I am facing this issue in the local simulation. I am using FDK - 8.6.7 versions

Thanks for the update. At a glance, you will see this error if something blocks FDK from communicating with the external service. This can be due to a firewall or if the external API is unavailable.

Can you share the following with us to debug further:

  1. Do requests to other HTTP APIs respond successfully from your local simulation?
  2. Do you see the same error if you publish the app in production as a custom app?
  3. Does the HTTP API in question use non-standard ports?
  4. The code used to send the request (with sensitive information redacted).
  5. A copy of fdk.log with any sensitive information redacted.


Hi @kaustavdm

Sorry for the late reply,
this issue is faced in local simulation also.

I have attached a request method screenshot.


@hemakumar Thanks for sending the code snippet. I still need answers to the remaining questions I have asked above. Mainly, are you able to send request to other external HTTP APIs from this app? We need to understand if you are seeing a behaviour specific to this API you have mentioned. These errors usually result from some network firewall restrictions or some behaviour of the external API.

The second argument to client.request.post(), if present, must be an options object that takes body as a property. I hope the body variable in the screenshot is properly structured. For example, if the body variable contains data to be sent as an HTTP request body, then you will have to rewrite the method call as:

client.request.post(url, { body })

Hi @kaustavdm ,
Thanks for your assistance, I have attached the body content screenshot below.

But I got a successful response sometimes,

Sometimes throws the 502 error, what is the exact issue? if any changes please let me know