Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

502 Bad Gateway error when calling an external API from a Forge app

Mathis Marchal
April 14, 2025

Hello,

I'm currently developing a Forge app for Jira, which aims to display a custom page listing vehicles. This data is fetched from an external API hosted on the company’s domain.

To achieve this, I'm using a backend function (resolver) that performs a fetch() request to the API, and a React frontend that calls this function using invoke('getVehicles'). The architecture seems correct, and I’ve properly declared the domain in the manifest.yml under permissions.external.fetch.backend.

However, when testing the app from Jira Cloud, I encounter a 502 Bad Gateway error in the console. Forge logs show an error of this kind:

"PS C:\Users\mathi\Documents\Stage\API\liste_VEH> forge logs
ERROR 2025-04-15T06:24:50.084Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 Erreur API: 502 Bad Gateway
INFO 2025-04-15T06:24:50.072Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 Réponse brute: Bad Gateway
INFO 2025-04-15T06:24:50.070Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 Statut HTTP: 502
INFO 2025-04-15T06:24:49.674Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 Body: ListVeh=
INFO 2025-04-15T06:24:49.673Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 Headers: {
"Authorization": "****************",
"Content-Type": "application/x-www-form-urlencoded"
}
INFO 2025-04-15T06:24:49.672Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 URL: url_API
INFO 2025-04-15T06:24:49.671Z 19f3b486-ec69-4f3e-9785-ba16b61ad7e4 Envoi de la requête à l’API externe..."

Interestingly, when I test the same request locally using curl, I get a valid response with the expected data. So, the API is clearly accessible from my personal network.

I'm wondering if this error could be related to the fact that my app uses a remote service, making it incompatible with the "Runs on Atlassian" program (as indicated by the forge eligibility command). Could this prevent outbound requests from Forge? Or could it be due to a network restriction on Atlassian's side, or even a server-side block on requests coming from Forge instances (e.g., due to user-agent, missing headers, etc.)?

I’ve attached the manifest.yml, index.js, and App.js files for reference.

Thank you in advance for your help,

Best regards,

Mathis.

 

Capture d'écran 2025-04-15 083459.pngCapture d'écran 2025-04-15 083437.pngCapture d'écran 2025-04-15 083508.png

1 answer

0 votes
Mercy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 10, 2025

A 502 Bad Gateway from a Forge resolver almost always means the external service rejected or failed to respond to the outbound request made through Atlassian’s controlled network. Forge backends run inside Atlassian’s infrastructure, so the request originates from Atlassian IP ranges—not your local network. If the target API only accepts traffic from specific IPs or enforces TLS or header checks, it will return 502 because Forge can’t reach it or the remote endpoint closes the connection. The “Runs on Atlassian” eligibility flag doesn’t restrict external calls; what matters is that the domain is listed correctly in `permissions.external.fetch.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events