I use Custom UI in my forge app. This app makes API calls to the external service.
I added my service URL to external.fetch.backend
(according to https://developer.atlassian.com/platform/forge/runtime-egress-permissions/)
API calls are made from the forge app.
Everything works file when I use forge tunnel and run react frontend locally. But, when I deploy my app, I get the next error:
ReferenceError: XMLHttpRequest is not defined
at dispatchXhrRequest (index.js:12360:19)
at new Promise (<anonymous>)
at xhrAdapter (index.js:12351:10)
at dispatchRequest (index.js:29724:10)
at Axios.request (index.js:29563:15)
at Axios.<computed> [as get] (index.js:29584:17)
at Function.wrap [as get] (index.js:12203:15)
import Resolver from '@forge/resolver';
const axios = require('axios');
const resolver = new Resolver();
resolver.define("testFunction", async (({ payload, context })) => {
const response = await axios.get('https://my-service-url/' + payload.id);
})