Undefined binding(s) detected when compiling WHERE. Undefined column(s): [t0.id] query: where `t0`.`id`

System Information
  • Strapi Version: 4.0.5
  • Operating System: Mac OS
  • Database: MySQL
  • Node Version: v14.17.5
  • NPM Version: 6.14.14
  • Yarn Version: 1.22.10

Getting this message on every query call on Collection Type.

Strapi with Graphql

{
  "errors": [
    {
      "message": "Undefined binding(s) detected when compiling WHERE. Undefined column(s): [t0.id] query: where `t0`.`id` = ?",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "technology",
        "data"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: Undefined binding(s) detected when compiling WHERE. Undefined column(s): [t0.id] query: where `t0`.`id` = ?",
            "    at QueryCompiler_MySQL.toSQL (/Users/devzakir/Dev/templatecookie/backend-v2/node_modules/knex/lib/query/querycompiler.js:110:13)",
1 Like

I have the same question

1 Like

I’ve just got this myself

Turns out it was because I was trying to query a single post without giving an id

So in the example above, he’s searching for “Technology”, that’s a single, so he’d also need to add an id:

technology(id: 1) { ...

Conclusion?

Either add in an id, or pluralise your query. In this case it would be “technologies”

3 Likes