Forums

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

URL not included in the external fetch backend permissions

Konrad
Contributor
October 3, 2024

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
after which I run commands:
forge deploy 

forge install --upgrade
but to no avail.
If I run the requestJira from the frontend (index.js) the method works fine, only when using resolver function I encounter this error. Does anyone have any clues what is going on?

 

 

2 answers

1 accepted

0 votes
Answer accepted
surendra bisoyi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2024

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"

 

Konrad
Contributor
November 26, 2024

Hi Surendra,

Thank you, this update resolved the issue.

0 votes
Tretta Technologies
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 3, 2024

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!

Konrad
Contributor
October 4, 2024

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]);
and in my resolvers/index.js:
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" };

  }

});

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

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 Now
AUG Leaders

Atlassian Community Events