Details
-
Bug
-
Resolution: Duplicate
-
High
-
Severity 1 - Critical
-
Description
Summary
When defining a dynamicMacro:
"dynamicContentMacros": [ { "url": "/hello-world?pageId={page.id}&pageVersion={page.version}¯oId={macro.id}¯oBody={macro.body}", "key": "anne-inspector-sketch-confluence", "name": { "value": "Anne Inspector Sketch" }, "categories": ["media"], "outputType": "block", "bodyType": "rich-text", "featured": true, "width": "100%", //some more code.. } ]
and using the context parameters in REST API calls:
app.get('/hello-world', addon.authenticate(), function (req, res) { // Rendering a template is easy; the `render()` method takes two params: name of template // and a json object to pass the context in console.log(`pageId= ${req.query.pageId}`); console.log(`pageVersion= ${req.query.pageVersion}`); console.log(`macroId= ${req.query.macroId}`); let httpClient = addon.httpClient(req); httpClient.get({ url: `rest/api/content/${req.query.pageId}/history/${req.query.pageVersion}/macro/id/${req.query.macroId}`, contentType: 'application/json', json: true, body:{"fields":{"customfield_10015":"SCRUM-4"}} }, (error, res, body) => { console.log(JSON.stringify(error, null, 2)); console.log(JSON.stringify(body, null, 2)); console.log(JSON.stringify(res, null, 2)); render(JSON.stringify(body, null, 2)); }); } );
An error is encountered:
{ "statusCode":404, "data":{ "authorized":false, "valid":true, "errors":[ ], "successful":false }, "message":"No macro found on content id : ContentId{id=11763746} with version: 1 and macroId: 80255a80-67db-49ce-add6-eee45e4cc2cb" }
Unlike the old editor, where a valid response is returned:
Steps to replicate
- Create a fresh ACE app
- Define a dynamicMacro (see above)
- From the index.js, modify the /hello-world route and add an httpClient get call
- Create a blog (this is where the new editor feature is on)
- Add dynamic macro and enter some text and publish
- Notice an error is encountered. Compare these with a page content
Workaround
None
Attachments
Issue Links
- duplicates
-
CONFCLOUD-64923 New Confluence Editor gives random macro id for dynamic content macros
- Closed
- is depended on by
-
DEVHELP-1483 Loading...
- is related to
-
DEVHELP-1784 Loading...
- mentioned in
-
Page Loading...
- relates to
-
DEVHELP-1739 Loading...
-
CFE-1859 Loading...
(1 relates to)