Confluence search in Forge app fails with HTTP/1.1 431 Request Header Fields Too Large

Hello
I’m have an app that I want to be an integration between jira software cloud and confluence cloud.

The idea for it is to update content of specific confluence pages based on data from jira. In the implementation I want to have a search field to find a page which I’ll update.

Issue

I’m using forge/bridge making bridge.requestConfluence('/wiki/rest/api/search?limit=25&cql=${query}') that hits this request URL:
https://api.atlassian.com/ex/confluence/ ... /wiki/rest/api/search?limit=25&cql=type=page

And it results in an error 400 Bad Request:

Response body:

com.atlassian.confluence.api.service.exceptions.SSStatusCodeException:
 CQL was parsed but the search manager was unable to execute the search. 
Error message: com.atlassian.confluence.api.service.exceptions.SSStatusCodeException: 
There was an illegal request passed to XP-Search Aggregator API :
 HTTP/1.1 431 Request Header Fields Too Large

Scopes listed in manifest.yaml

permissions:
  scopes:
    - storage:app
    - read:jira-user
    - read:jira-work
    - read:board-scope:jira-software
    - read:project:jira
    - delete:board-scope.admin:jira-software
    - read:board-scope.admin:jira-software
    - read:epic:jira-software
    - read:issue:jira-software
    - write:sprint:jira-software
    - read:sprint:jira-software
    - read:page:confluence
    - read:confluence-props
    - search:confluence
    - read:confluence-user

There aren’t any apparent issues, it’s the simples possible usage of the confluence API there are no docs explaining this behaviour.

How can this be fixed, if at all? Most likely it’s something very obvious that I can’t notice.

Hi @MaksymVyzniuk

There is an internal limitation in Forge (which we are working on fixing) that can cause requests to exceed their max header size if the app has a large number of OAuth scopes declared in the app manifest.

To check if this is what’s happening to you, try reducing the number of scopes used by your app to see if that fixes the problem.

Some additional information and alternative workarounds are available on this bug report: [FRGE-643] - Ecosystem Jira

2 Likes