When trying to import content from another Ghost blog, an exception is thrown.
This is done using the Export / Import tool in the Labs section of the backend, so issues are expected.
Docker logs is giving the following information:
ERROR: Transaction query already complete, run with DEBUG=knex:tx for more info
Error: Transaction query already complete, run with DEBUG=knex:tx for more info
at completedError (/usr/src/ghost/node_modules/knex/lib/transaction.js:252:9)
at /usr/src/ghost/node_modules/knex/lib/transaction.js:224:22
at tryCatcher (/usr/src/ghost/node_modules/knex/node_modules/bluebird/js/main/util.js:26:23)
at Function.Promise.attempt.Promise.try (/usr/src/ghost/node_modules/knex/node_modules/bluebird/js/main/method.js:31:24)
at Client.trxClient.query (/usr/src/ghost/node_modules/knex/lib/transaction.js:222:26)
at Transaction_MySQL.query (/usr/src/ghost/node_modules/knex/lib/dialects/mysql/transaction.js:18:28)
at Transaction_MySQL.rollback (/usr/src/ghost/node_modules/knex/lib/transaction.js:111:17)
at Function.transactor.rollback (/usr/src/ghost/node_modules/knex/lib/transaction.js:192:18)
at /usr/src/ghost/core/server/data/import/data-importer.js:110:34
at tryCatcher (/usr/src/ghost/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:502:31)
at Promise._settlePromise (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:559:18)
at Promise._settlePromise0 (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:604:10)
at Promise._settlePromises (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:683:18)
at Promise._fulfill (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:628:18)
at Promise._resolveCallback (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:423:57)
at Promise._settlePromiseFromHandler (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:514:17)
at Promise._settlePromise (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:559:18)
at Promise._settlePromise0 (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:604:10)
at Promise._settlePromises (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:683:18)
at Promise._fulfill (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:628:18)
at PromiseArray._resolve (/usr/src/ghost/node_modules/bluebird/js/release/promise_array.js:125:19)
at PromiseArray._promiseFulfilled (/usr/src/ghost/node_modules/bluebird/js/release/promise_array.js:143:14)
at Promise._settlePromise (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:564:26)
at Promise._settlePromise0 (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:604:10)
at Promise._settlePromises (/usr/src/ghost/node_modules/bluebird/js/release/promise.js:683:18)
at Async._drainQueue (/usr/src/ghost/node_modules/bluebird/js/release/async.js:138:16)
at Async._drainQueues (/usr/src/ghost/node_modules/bluebird/js/release/async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/src/ghost/node_modules/bluebird/js/release/async.js:17:14)
Hi @chrishawes, sorry to hear you're having trouble with the importer.
In general, the importer should work, so we need to figure out what detail about this import isn't working.
Is it possible to try running Ghost using DEBUG=knex:tx npm start --production (or set DEBUG=knex:tx as an env var before running Ghost) and then provide us the output from the import with that turned on? It'll be a lot so will need to go in a gist or similar.
Alternatively, would you be able to provide the content you were importing (email is fine)?
I spun up another copy of Ghost on a Vagrant VM to run through your steps and was unable to recreate the issue!
I believe it was down to moving the data volume on my MySQL container.
All sorted now, apologies for the false alarm!
I'm running into the same issue, trying to import a self-hosted version of a ghost blog into the hosted version.
I can also reproduce this issue on a MySQL database. Below is the message after turning on DEBUG=knex:tx.
Sun, 08 Jan 2017 17:18:39 GMT knex:tx trx4: Starting top level transaction
Sun, 08 Jan 2017 17:18:43 GMT knex:tx undefined: Transaction completed: ROLLBACK;
Sun, 08 Jan 2017 17:18:43 GMT knex:tx trx4 error running transaction query
Sun, 08 Jan 2017 17:18:43 GMT knex:tx trx4: releasing connection
ERROR: Transaction query already complete, run with DEBUG=knex:tx for more info
DEBUG=knex:* gives more detailed information.
...
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings [ 75, 1 ]
Sun, 08 Jan 2017 17:24:35 GMT knex:query select `users`.* from `users` where `users`.`id` = ? limit ?
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings [ 76, 1 ]
Sun, 08 Jan 2017 17:24:35 GMT knex:query select `users`.* from `users` where `users`.`id` = ? limit ?
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings [ 77, 1 ]
Sun, 08 Jan 2017 17:24:35 GMT knex:query select `users`.* from `users` where `users`.`id` = ? limit ?
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings [ 79, 1 ]
Sun, 08 Jan 2017 17:24:35 GMT knex:query select `users`.* from `users` where `users`.`id` = ? limit ?
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings [ 80, 1 ]
Sun, 08 Jan 2017 17:24:35 GMT knex:query select `users`.* from `users` where `users`.`id` = ? limit ?
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings [ 81, 1 ]
Sun, 08 Jan 2017 17:24:35 GMT knex:query ROLLBACK;
Sun, 08 Jan 2017 17:24:35 GMT knex:bindings undefined
Sun, 08 Jan 2017 17:24:35 GMT knex:tx undefined: Transaction completed: ROLLBACK;
Sun, 08 Jan 2017 17:24:35 GMT knex:tx trx4 error running transaction query
Sun, 08 Jan 2017 17:24:35 GMT knex:tx trx4: releasing connection
Sun, 08 Jan 2017 17:24:35 GMT knex:client releasing connection to pool: __knexUid2
Sun, 08 Jan 2017 17:24:35 GMT knex:pool INFO pool mysql:mysql:client0 - dispense() clients=0 available=3
ERROR: Transaction query already complete, run with DEBUG=knex:tx for more info
Seems like that the query is failed due to a duplicate user, causing the entire transaction to fail. The backup data is malformed, generated from Ghost exporter. It should fail, but the reason of failure is not well-described.
I had verified my guess by fixing the user data manually, and luckily, it no longer failed.
this mistake from the exporter is still existing. Is there no other way than fixing it manually?
There is an open pull request which ignores duplicate users, see https://github.com/TryGhost/Ghost/pull/8016/files. Will be available in the next LTS release.
Most helpful comment
I can also reproduce this issue on a MySQL database. Below is the message after turning on
DEBUG=knex:tx.DEBUG=knex:*gives more detailed information.Seems like that the query is failed due to a duplicate user, causing the entire transaction to fail. The backup data is malformed, generated from Ghost exporter. It should fail, but the reason of failure is not well-described.
I had verified my guess by fixing the user data manually, and luckily, it no longer failed.