drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[BUG]: drizzle-kit push TypeError: This statement does not return data. Use run() instead

Open MoeDevelops opened this issue 1 year ago • 9 comments

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

0.24.0

Describe the Bug

When running npx drizzle-kit push and confirming, that I want to execute, I get this error:

TypeError: This statement does not return data. Use run() instead
    at Object.query (/home/moe/Development/valonia/node_modules/drizzle-kit/bin.cjs:72146:53)
    at sqlitePush (/home/moe/Development/valonia/node_modules/drizzle-kit/bin.cjs:74808:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (/home/moe/Development/valonia/node_modules/drizzle-kit/bin.cjs:83114:9)
    at async rawCli (/home/moe/Development/valonia/node_modules/drizzle-kit/bin.cjs:81492:5)
    at async run (/home/moe/Development/valonia/node_modules/drizzle-kit/bin.cjs:81500:5)

Expected behavior

No response

Environment & setup

I'm on Fedora Linux

drizzle.config.ts:

import type { Config } from "drizzle-kit"

export default {
    schema: "./src/lib/db/schema.ts",
    out: "./migrations",
    dialect: "sqlite",
    dbCredentials: {
        url: "./sqlite.db"
    },
    verbose: true,
    strict: true
} satisfies Config

MoeDevelops avatar Aug 08 '24 18:08 MoeDevelops

I am facing same issue did you get any answers on how to fix it

IzaanAnwar avatar Aug 11 '24 12:08 IzaanAnwar

Nope

MoeDevelops avatar Aug 11 '24 20:08 MoeDevelops

I had to downgrade to version 0.22.8 to get it working again

simontong avatar Aug 17 '24 00:08 simontong

We're experiencing the same issue, downgrading to 0.22.8 (accomplished by ~0.22) has solved the issue. This seems to be a bug introduced in the 0.23.0 release, since 0.23.0 itself was still throwing the error.

yamcodes avatar Aug 17 '24 15:08 yamcodes

Yup, same behavior happening in 0.24.0, downgrading to 0.22.8 fixed the issue.

My config looks like the following, I'm using better-sqlite3:

import type { Config } from "drizzle-kit";

export default {
  schema: "./lib/dbSchema.ts",
  out: "./drizzle",
  dialect: "sqlite",
  dbCredentials: {
    url: "./sqlite.db",
  },
  verbose: true,
  strict: true,
} satisfies Config;

ahmadaccino avatar Aug 18 '24 03:08 ahmadaccino

@simontong @yamcodes @ahmad1702 Thanks for sharing input Same in our team - after stuggling for a few days - we've regressed back to version 0.22.8, which solved the issue.

thinkvisual avatar Aug 21 '24 20:08 thinkvisual

I were on 0.24.2 and downgraded to 0.22.8 and this fixed my issue. So the bug is still there in 0.24.2

Sayrix avatar Oct 02 '24 11:10 Sayrix

Confirming I also encountered this issue on 0.24.2 and also solved it by downgrading to 0.22.8.

Clonkex avatar Oct 03 '24 11:10 Clonkex

Related to

  • https://github.com/drizzle-team/drizzle-kit-mirror/issues/500
  • #2623

Workarounds:

  • https://github.com/drizzle-team/drizzle-kit-mirror/issues/500#issuecomment-2229782233)
    • change query to run directly in the package
  • https://github.com/drizzle-team/drizzle-kit-mirror/issues/500#issuecomment-2239083475
    • use migrate instead of push
  • Or downgrade to v0.22.8 as discussed.

There is a draft pull request here that fixes the issue:

  • https://github.com/drizzle-team/drizzle-orm/pull/2959

Basically applying the first "workaround" change above:

https://github.com/drizzle-team/drizzle-orm/pull/2959/files#diff-175921cf89e73c94f44fd1a05f60a0378c3c2463b032a87cd3450e40653bc11dR365

nktnet1 avatar Oct 03 '24 14:10 nktnet1

Both versions on latest, still happens.

0xRapid avatar Oct 20 '24 02:10 0xRapid

Closing in favor of #2623.

L-Mario564 avatar Oct 23 '24 17:10 L-Mario564