question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue Summary

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.

Steps to Reproduce

  1. Export your blog content
  2. Import blog content

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)

Technical details:

  • Ghost Version: 0.8 Official Docker Image sha256:24e3ba4709202b759eecea009baf7c27c7f6c89f77adef718750d6e9eeb2618f
  • Node Version: v4.2.6
  • Browser/OS: Safari Technology Preview
  • Database: MySQL Ver 14.14 Distrib 5.7.12

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
andy0130twcommented, Jan 8, 2017

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.

2reactions
ErisDScommented, May 24, 2016

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)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the cause of The import failed due to an error in ... - IBM
One of the more common causes is having duplicate primary keys within the spreadsheet.?If a column has been marked as a primary key...
Read more >
My data import failed. What do I have to do? | Help Center
When importing a file into Spotzi there might occur an error. Please use this guide as a reference in order to fix your...
Read more >
Python - fails importing package - Stack Overflow
modelmaker import command_file , i get the following error: ValueError: Attempted relative import in non-package . Do i need anything special in ...
Read more >
How to Fix “Import Failed” Mail Error on Mac - OSXDaily
The import failure prevents the Mail app from opening any further, and therefore renders the Mail app and inboxes unusable.
Read more >
Common Reasons for Import Failures - Outreach Support
Failed imports appear on the Imports landing page in the Outreach platform ... A solid red progress bar indicates the entire import failed....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found