Recently my macro start reporting an error on the Edit page. After some investigation I've found a problem and it seems to be on Atlassian's side.
While loading my macro is requesting the current page content using PageID parameter passed to in in the request URL.
For example page URL is https://subdomain.atlassian.net/wiki/spaces/SWAGER/pages/1425309123
App request is https://app.com/v2/openapi?pageId=1425309123
PageId matches and everything works fine.
On the edit page though it doesn't match.
Edit page URL is https://stepashka.atlassian.net/wiki/spaces/SWAGER/pages/edit-v2/1425309123
but the app is called with different page ID for example https://app.com/v2/openapi?pageId=1425309321
It is the case on the pages that were created some time ago. After page is published the issue is resolved and everything is working fine.
Any ideas why it happens and how to fix it?