Having just gone through the Forge tutorial, I’m trying to play around and do some more advanced things.
One thing I’m trying to do is create pages in the same Confluence space at the click of a button. However, my request never completes, at least as far as I can tell.
const createPage = async (space) => {
console.log("Okay, let's try and create a page in ", space)
const data = await api
.asUser()
.requestConfluence(`/rest/api/content`, {
method: 'POST',
body: JSON.stringify({
title: 'Thing',
type: 'page',
space: space,
body: {
storage: "New page stuff",
representation: "view"
}
})
}).then(stuff => {
console.log("Stuff", stuff)
return stuff
}, (rejectionReason) => {
console.error("Nah, yer rejected", rejectionReason)
}).catch(e => {
console.error("Received error", e)
})
console.log("Got some data back:", data)
return data
}
I’ve run forge lint --fix, and my manifiest does indeed have the required scopes in my manifest.
I can’t find anything in forge logs to indicate what’s happening with my request. Possibly I’m just a bit newbish with node-fetch, but I don’t get why there’s nothing in the logs.
Assuming the function is being triggered ok, I have added some additional logs to the response which may provide some more insight into if the request is happening.
And here’s what I get in the logs of forge tunnel:
invocation: cdbcd60df3e9be0b index.run
INFO 14:33:39.459 cdbcd60df3e9be0b I push da buddin!
INFO 14:33:39.466 cdbcd60df3e9be0b Okay, let's try and create a page in TEST
It’s clear that the createPage function gets called, but it looks like my then functions don’t ever execute, whether they’re async or not.