Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4
-
Severity 2 - Major
-
Description
Summary
When using the endpoint /rest/api/content to create a lot of pages at the same time. This is easily replicable by doing a simple for loop:
const httpClient = addon.httpClient(req).asUser("admin"); let n = 100; for(let i =0 ; i<n; i++) { httpClient.post({ headers: { "X-Atlassian-Token": "nocheck", }, json: { body: { storage: { representation: "storage", value: "<p>Something</p>" } }, space: { key: "SPACE_KEY" }, title: `Page ${i} of ${n}`, type: "page" }, url: "/rest/api/content", }, function (error, response, body) { console.log('=========================================================='); console.log(`Error: ${JSON.stringify(error, null, 2)}`); console.log(`Response: ${JSON.stringify(response, null, 2)}`); console.log(`Body: ${JSON.stringify(body, null, 2)}`); console.log('=========================================================='); }); }
You'd eventually lead to an exception:
{ "statusCode": 500, "body": { "statusCode": 500, "message": "org.springframework.orm.hibernate5.HibernateOptimisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1" }, "headers": { "server": "Atlassian Proxy/1.13.6.2", "cache-control": "no-cache, must-revalidate", "content-type": "application/json", "strict-transport-security": "max-age=315360000; includeSubDomains; preload", "date": "Mon, 03 Dec 2018 02:42:38 GMT", "atl-traceid": "4a5657e212892d86", "expires": "Thu, 01 Jan 1970 00:00:00 GMT", "x-xss-protection": "1; mode=block", "transfer-encoding": "chunked", "atl-tcs-time": "Cache Hit", "x-ausername": "annecalantog", "x-content-type-options": "nosniff", "connection": "close", "atl-confluence-via": "h:confluence-prod-us-8-3.prod.atl-paas.net" }, "request": { "uri": { "protocol": "https:", "slashes": true, "auth": null, "host": "<instance-name>.atlassian.net", "port": 443, "hostname": "<instance-name>.atlassian.net", "hash": null, "search": null, "query": null, "pathname": "/wiki/rest/api/content", "path": "/wiki/rest/api/content", "href": "https://<instance-name>.atlassian.net/wiki/rest/api/content" }, "method": "POST", "headers": { "X-Atlassian-Token": "nocheck", "authorization": "Bearer <bearer-token>", "User-Agent": "atlassian-connect-express/2.1.4", "accept": "application/json", "content-type": "application/json", "content-length": 145 } } }
Workaround
Post pages in a strict sequential manner
Attachments
Issue Links
- is related to
-
CONFCLOUD-66425 After migration from Confluence Server to cloud pages are displaying GraphQL errors
- Closed
- relates to
-
DEVHELP-1940 Loading...