REST V2 API stops working after uninstall/install cycle of my app

I have a function that is called by my app to get the page body:

const fetchPageWithBody = async ( pageId) => {
  const res = await api
    .requestConfluence(route`/wiki/api/v2/pages/${pageId}?body-format=atlas_doc_format`, {
      headers: {
        'Accept': 'application/json'
  console.log(`fetchPageWithBody: All info about my route /wiki/api/v2/pages/${pageId} res: ${JSON.stringify(res, null, 2)}`);
  const data = await res.json();
  return data;

This used to work without a problem. Then I was changing my app adding some permissions as I also want to update the page programatically. I ran into various permissions problems for the update which I was able to solve with adapting my manifest and code.

In the run of those fixes I had to reinstall my app. And ever since, my app works not it cannot find the page anymore. I know it is there (I can just put the REST URL in my browser and I can get it (asUser of course)

The log tells me:

INFO    2023-04-01T12:28:10.301Z 6b48afe9-2566-4e16-ac36-4060ff3c3604 fetchPageWithBody: All info about my route /wiki/api/v2/pages/3866625 res: {
  "headers": {},
  "ok": false,
  "status": 404,
  "statusText": "Not Found"

Getting the REST URL via the browser (if logged in):

gets me:


In other words, the page is there, the app has permissions:

    - read:confluence-content.summary
    - read:confluence-content.all
    - read:page:confluence
    - storage:app
    - read:space:confluence
    - read:confluence-props
    - write:confluence-content
    - write:confluence-space
    - write:confluence-props

but the page is ‘Not Found’. The result is the same when I am logged out so it looks like a permissions problem in my manifest. forge lint --fix doesn’t report any issues. Going back to previous scopes doesn’t help either. I’m out of ideas.

The problem magically disappeared (but see below, it returned). It feels rather odd:

  • First it simply stopped working, for no obvious reason
  • Then later it turned out page viewed triggers had stopped working too
  • Then I was clicking around in my sites configuration to see if I could find some permission that was wrong — I did not change anything
  • And suddenly after that, my trigger and my api call started working again

I am now back to the situation where the api call works in the circumstances it should, but I have no idea why.

I have been clicking around in the site settings without changing anything, running forge deploy, forge uninstall/install, basically a lot of random behaviour that should not have changed anything. But it did.

And then I ran into an api v2 update page not working for unclear reasons (API v2 update page: code: 403, message: 'The app is not installed on this instance' - #2 by GerbenWierda). For that I found the tip to uninstall/install again. Which I did and lo and behold: simply doing uninstall/install has killed my app from using the api v2 page read.

It is now really starting to feel like an ‘unreliable’ environment.

[1 hour later]: I had closed my browser windows on the site. I returned. Opened the Wiki. Displayed a page and suddenly the read api call and the trigger works again. The update still doesn’t work. It seems that uninstall/install needs some time to ‘settle’. I am marking this as solved again.

[Few hours later]. I did an uninstall/reinstall again. The api read call works again pretty quickly. The page view trigger is dead again (no idea how long and under which circumstances it works again).