drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
24.54k stars 643 forks source link

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

Closed MoeDevelops closed 3 weeks ago

MoeDevelops commented 3 months ago

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
IzaanAnwar commented 3 months ago

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

MoeDevelops commented 3 months ago

Nope

simontong commented 3 months ago

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

yamcodes commented 3 months ago

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.

ahmad1702 commented 3 months ago

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;
thinkvisual commented 2 months ago

@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.

Sayrix commented 1 month ago

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

Clonkex commented 1 month ago

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

nktnet1 commented 1 month ago

Related to

Workarounds:

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

Basically applying the first "workaround" change above:

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

0xRapid commented 1 month ago

Both versions on latest, still happens.

L-Mario564 commented 3 weeks ago

Closing in favor of #2623.