Unexpected token Error in Confluence Search API Call

Hello Everyone,

I’m fairly new to Forge and I’m trying to start by writing my own app that will make use of the Search API to display some information in a table.

When running a ‘forge deploy’. I’m getting the following error:

Running forge lint...
Error: unknown: Unexpected token, expected ";" (69:25)
  67 | 
  68 |  function getSearchResults(searchAPI) {
> 69 |   let response = await api.asUser().requestConfluence(searchAPI, {
   |              ^
  70 |    headers: {
  71 |     'Accept': 'application/json'
  72 |    }

I’ve looked over the entire function multiple times, and I can’t see where I have made my mistake:

function getSearchResults(searchAPI) {
    const response = await api.asUser().requestConfluence(searchAPI, {
      headers: {
        'Accept': 'application/json'
    return response.json;

Does anyone have any thoughts or suggestions on what I’ve done wrong? Or other things I should consider looking at to get to the root of my problems?

Thanks in advance!

I believe that to make use of await, you need to make the function async so this:


async function getSearchResults(searchAPI) {

More on async/await: Async/await

Curious to see if that changes anything.

1 Like

Thank you @bcook!

I hadn’t even thought about that being an issue. I’ll give that a try and let you know what happens.


That was exactly my issue! Thank you @bcook I really appreciate the quick response and the help getting past that issue!

1 Like