ERROR [request error] [unhandled] [GET] http://localhost:3000/api/todos 5:04:25 PM
ℹ Error: Failed query: select "id", "title", "completed", "createdAt", "updatedAt" from "todos" "todos" where "todos"."completed" = $1 order by "todos"."createdAt" desc
params: false
⁃ at PglitePreparedQuery.queryWithCache (node_modules/.pnpm/drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251219.0_@electric-sql+pglite@0.3.14_@_ab7351832084d4e7e84d05d5bcf8f4c1/node_modules/drizzle-orm/pg-core/session.js:41:15)
⁃ at async PglitePreparedQuery.execute (node_modules/.pnpm/drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251219.0_@electric-sql+pglite@0.3.14_@_ab7351832084d4e7e84d05d5bcf8f4c1/node_modules/drizzle-orm/pglite/session.js:70:20)
⁃ at async Object.handler (playground/server/api/todos/index.get.ts:6:0)
1 ┃ import { desc, eq } from 'drizzle-orm'
2 ┃ import { db } from '@nuxthub/db'
3 ┃
4 ┃ export default eventHandler(async () => {
5 ┃ // List todos for the current user
❯ 6 ┃ return await db.query.todos.findMany({
7 ┃ where: eq(schema.todos.completed, false),
8 ┃ orderBy: [desc(schema.todos.createdAt)]
9 ┃ })
10 ┃ })
11 ┃
⁃ (async file://node_modules/.pnpm/h3@1.15.5/node_modules/h3/dist/index.mjs:2011:19)
⁃ at async Object.callAsync (node_modules/.pnpm/unctx@2.4.1/node_modules/unctx/dist/index.mjs:72:16)
⁃ at async Object.callAsync (node_modules/.pnpm/unctx@2.4.1/node_modules/unctx/dist/index.mjs:72:16)
⁃ at async toNodeHandle (node_modules/.pnpm/h3@1.15.5/node_modules/h3/dist/index.mjs:2303:7)
⁃ at async b (node_modules/.pnpm/node-mock-http@1.0.4/node_modules/node-mock-http/dist/index.mjs:1:6876)
⁃ at async C (node_modules/.pnpm/node-mock-http@1.0.4/node_modules/node-mock-http/dist/index.mjs:1:7159)
⁃ at async $fetchRaw2 (node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs:274:26)
[CAUSE]
C {
stack: 'invalid input syntax for type integer: "false"\n' +
'at ye.Ve (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-3WWIVTCY.js:1:17616)\n' +
'at ye.nt (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-3WWIVTCY.js:1:15003)\n' +
'at ye.parse (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-3WWIVTCY.js:1:13755)\n' +
'at ./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/index.js:3:191801)\n' +
'at wasm://wasm/021cbcb2:wasm-function[3707]:0x27cef1:undefined:undefined)\n' +
'at wasm://wasm/021cbcb2:wasm-function[3717]:0x27d268:undefined:undefined)\n' +
'at wasm://wasm/021cbcb2:wasm-function[9494]:0x509d72:undefined:undefined)\n' +
'at wasm://wasm/021cbcb2:wasm-function[175]:0x598a3:undefined:undefined)\n' +
'at invoke_v (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@'... 115 more characters,
message: 'invalid input syntax for type integer: "false"',
length: 148,
name: 'error',
severity: 'ERROR',
code: '22P02',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: "unnamed portal parameter $1 = '...'",
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'numutils.c',
line: '619',
routine: 'pg_strtoint32_safe',
query: 'select "id", "title", "completed", "createdAt", "updatedAt" from
"todos" "todos" where "todos"."completed" = $1 order by
"todos"."createdAt" desc',
params: [
false,
],
queryOptions: {
rowMode: 'array',
parsers: [Object],
},
}
ERROR [request error] [unhandled] [GET] http://localhost:3000/api/todos 5:04:25 PM
ℹ Error: Failed query: select "id", "title", "completed", "createdAt", "updatedAt" from "todos" "todos" where "todos"."completed" = $1 order by "todos"."createdAt" desc
params: false
⁃ at PglitePreparedQuery.queryWithCache (node_modules/.pnpm/drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251219.0_@electric-sql+pglite@0.3.14_@_ab7351832084d4e7e84d05d5bcf8f4c1/node_modules/drizzle-orm/pg-core/session.js:41:15)
⁃ at async PglitePreparedQuery.execute (node_modules/.pnpm/drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251219.0_@electric-sql+pglite@0.3.14_@_ab7351832084d4e7e84d05d5bcf8f4c1/node_modules/drizzle-orm/pglite/session.js:70:20)
⁃ at async Object.handler (playground/server/api/todos/index.get.ts:6:0)
1 ┃ import { desc, eq } from 'drizzle-orm'
2 ┃ import { db } from '@nuxthub/db'
3 ┃
4 ┃ export default eventHandler(async () => {
5 ┃ // List todos for the current user
❯ 6 ┃ return await db.query.todos.findMany({
7 ┃ where: eq(schema.todos.completed, false),
8 ┃ orderBy: [desc(schema.todos.createdAt)]
9 ┃ })
10 ┃ })
11 ┃
⁃ (async file://node_modules/.pnpm/h3@1.15.5/node_modules/h3/dist/index.mjs:2011:19)
⁃ at async Object.callAsync (node_modules/.pnpm/unctx@2.4.1/node_modules/unctx/dist/index.mjs:72:16)
⁃ at async Object.callAsync (node_modules/.pnpm/unctx@2.4.1/node_modules/unctx/dist/index.mjs:72:16)
⁃ at async toNodeHandle (node_modules/.pnpm/h3@1.15.5/node_modules/h3/dist/index.mjs:2303:7)
⁃ at async b (node_modules/.pnpm/node-mock-http@1.0.4/node_modules/node-mock-http/dist/index.mjs:1:6876)
⁃ at async C (node_modules/.pnpm/node-mock-http@1.0.4/node_modules/node-mock-http/dist/index.mjs:1:7159)
⁃ at async $fetchRaw2 (node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs:274:26)
[CAUSE]
C {
stack: 'invalid input syntax for type integer: "false"\n' +
'at ye.Ve (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-3WWIVTCY.js:1:17616)\n' +
'at ye.nt (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-3WWIVTCY.js:1:15003)\n' +
'at ye.parse (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-3WWIVTCY.js:1:13755)\n' +
'at ./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/index.js:3:191801)\n' +
'at wasm://wasm/021cbcb2:wasm-function[3707]:0x27cef1:undefined:undefined)\n' +
'at wasm://wasm/021cbcb2:wasm-function[3717]:0x27d268:undefined:undefined)\n' +
'at wasm://wasm/021cbcb2:wasm-function[9494]:0x509d72:undefined:undefined)\n' +
'at wasm://wasm/021cbcb2:wasm-function[175]:0x598a3:undefined:undefined)\n' +
'at invoke_v (./node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@'... 115 more characters,
message: 'invalid input syntax for type integer: "false"',
length: 148,
name: 'error',
severity: 'ERROR',
code: '22P02',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: "unnamed portal parameter $1 = '...'",
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'numutils.c',
line: '619',
routine: 'pg_strtoint32_safe',
query: 'select "id", "title", "completed", "createdAt", "updatedAt" from
"todos" "todos" where "todos"."completed" = $1 order by
"todos"."createdAt" desc',
params: [
false,
],
queryOptions: {
rowMode: 'array',
parsers: [Object],
},
}
Describe the bug
/api/todosGETthrows issue in postgresThis is caused by invalid query
Steps to reproduce
/database