Hi,
I am developing my first app using forge and I get this error:
[REQUEST_EGRESS_ALLOWLIST_ERR: URL not included in the external fetch backend permissions: /rest/api/3/filter/10002. Visit go.atlassian.com/forge-egress for more information.] status: 403
inside resolver, when trying to fetch specific filter from Jira cloud using requestJira method:
const res = await requestJira(route`/rest/api/3/filter/${filterId}`);
Using egress permissions site I updated my scopes to include:
permissions:
scopes:
- read:jira-user
- read:jira-work
- read:filter:jira
external:
fetch:
backend:
- https://xx-dev.atlassian.net
forge deploy
forge install --upgrade
Hi @Konrad ,
After updating the Forge API to the latest version, the issue was resolved. I used the command: npm install @forge/api@latest
This automatically updated the `package.json` file with the entry: "@forge/api": "^4.1.0"
Hi Konrad,
When making a request to the Jira REST API from within the resolvers directory you'll want to import the api in addition to the route object at the top level so you can build the request like this:
const res = await api.asApp().requestJira(route`/rest/api/3/filter/${filterId}`);
The api.asApp() portion ensures the request is made authenticated as the app.
Also, when testing Atlassian APIs during development it can be helpful to use '*.atlassian.net' for your backend egress permissions to cover various scheme/subdomain combinations.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for the answer, I should have mentioned that I did tried to run it with:
api.asApp() method however with same result. I also tried the domain name to include wild card as you suggested: '*.atlassian.net', unfortunatelly it doesnt work.
I keep reading this: runtime-egress-permissions to make sure I haven't miss anything but at this point I honestly I don't know what I am doing wrong.
Any chance you could share piece of resolver code that worked for you?
Just to show what I got in my frontend/index.jsx file (calling function):
useEffect(() => {
if (filterId) {
const fetchFilter = async () => {
try {
// Invoke the resolver to fetch filter data based on filterId
const response = await invoke('getFilterById', { filterId });
if (response.error) {
setError(response.error);
} else {
setFilterData(response.filter);
}
} catch (err) {
setError('An error occurred while fetching the filter');
console.error(err);
}
};
fetchFilter();
}
}, [filterId]);
resolver.define('getFilterById', async (req) => {
// console.log("Inside resolver function ...");
const filterId = req.payload.filterId;
if (!filterId) {
console.error("Error: No filterId provided!");
return { error: "Filter ID is required" };
}
try {
console.log("Running resolver function with filterId: ", filterId);
const res = await api.asApp().requestJira(route `/rest/api/3/filter/${filterId}`)
if (!res.ok) {
console.error("Error fetching filter:", res.status, res.statusText);
return { error: `Error fetching filter: ${res.statusText}` };
}
const filterData = await res.json();
console.log("Filter data: ", filterData);
return { status: res.status, filter: filterData };
} catch (err) {
console.error("Exception occurred: ", err);
return { error: "An error occurred while fetching the filter" };
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.