lucid: Error: Transaction query already complete, run with DEBUG=knex:tx for more info, Browser client test

About the error

I am using browser client provided by japa to run e2e tests.

I’m tryng to run global transaction for each test on group using the code above: Screenshot from 2024-01-26 09-37-39

And i’m having this error:

at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at Runner.run (/<PROJECT_PATH>/node_modules/knex/lib/execution/runner.js:30:19)\n    at QueryRunner.executeQuery (/<PROJECT_PATH>/node_modules/@adonisjs/lucid/build/src/QueryRunner/index.js:78:28)",
"type":"Error","msg":"Transaction query already complete, run with DEBUG=knex:tx for more info"

Using the aproach above is triggering the same error: Screenshot from 2024-01-26 09-39-02

Related libs version:

"webpack": "^5.89.0",
"playwright": "1.33.0",
"@japa/runner": "2.5.0"
"@japa/browser-client": "1.2.0",
"@adonisjs/assembler": "5.9.6"
"@adonisjs/core": "5.9.0",
"@adonisjs/lucid": "18.3.0"

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

okay so this is the output i have :

image

we can see that the test timeout. if you disable timeouts then you shouldn’t get this error anymore :

  test(`create ${batchSizes} TestData`, async ({ assert }) => {
    for (let i = 0; i < batchSizes; i++) {
      await fetch(`http://${env.get('HOST')}:${env.get('PORT')}/test`, {
        method: 'POST',
        body: JSON.stringify({
          text: faker.word.sample(),
          text2: faker.word.sample(),
          text3: faker.word.sample(),
          text4: faker.word.sample(),
        }),
      })
    }

    assert.equal(true, true)
  }).disableTimeout() // 👈👈👈

Let me know if it works for you

https://github.com/Tahul/lucid-transactions-repro

I’m working on the repro in this repository.

I searched again, only have these global transactions that are runned in setup and teardown. I will create a replication repo