create-t3-turbo
create-t3-turbo copied to clipboard
bug: can't use sql in $onUpdateFn, value.toISOString is not a function
Provide environment information
System: OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa) CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor Memory: 3.74 GB / 9.72 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm pnpm: 9.2.0 - ~/.nvm/versions/node/v20.12.2/bin/pnpm bun: 1.0.29 - ~/.bun/bin/bun
Describe the bug
tRPC Error on 'post.update' [TRPCError: value.toISOString is not a function] {
code: 'INTERNAL_SERVER_ERROR',
name: 'TRPCError'
}
It seems that we can't use sql in $onUpdateFn? Did this used to work? https://github.com/drizzle-team/drizzle-orm/issues/2212#issuecomment-2114083803
Link to reproduction
https://github.com/t3-oss/create-t3-turbo
To reproduce
Update a post
Additional information
No response
@trevorpfiz looks not related with this repo. am i missing something?
@trevorpfiz looks not related with this repo. am i missing something?
https://github.com/t3-oss/create-t3-turbo/blob/791c06f64f736bb28eeab832e848ae812a67066f/packages/db/src/schema.ts#L22
still an issue.https://github.com/drizzle-team/drizzle-orm/issues/2212 works with mode: string when update db.
I encounter the same question and solve it by changing the callback to:
updatedAt: timestamp("updated_at", {
mode: "date",
withTimezone: true,
}).$onUpdateFn(() => new Date()),
See also https://github.com/drizzle-team/drizzle-orm/issues/1113 https://github.com/drizzle-team/drizzle-orm/issues/2212