Ani
Ani
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Ani on 9/30/2024 in #questions
Open AI Billing me 3 Times for GPT Plus
Hey everyone! I just got charged 3 times for a GPT Plus subscription. Their support website is completely unable, any advice on how I would go about getting a refund?
4 replies
TTCTheo's Typesafe Cult
Created by Ani on 7/8/2024 in #questions
Imports and exports not working turborepo
Using create-t3-turbo I have declared Projects in the db schema:
// schema.ts
export const Projects = pgTable("projects", {
name: varchar("name", { length: 128 }).notNull(),
description: text("description"),
})
// schema.ts
export const Projects = pgTable("projects", {
name: varchar("name", { length: 128 }).notNull(),
description: text("description"),
})
but when i try and import this in server package I keep getting the error:
// for the code:
import { User, Projects } from "@amaxa/db/schema";
//the error
Module '"@amaxa/db/schema"' has no exported member 'Projects'.ts(2305)
// for the code:
import { User, Projects } from "@amaxa/db/schema";
//the error
Module '"@amaxa/db/schema"' has no exported member 'Projects'.ts(2305)
6 replies
DTDrizzle Team
Created by Ani on 7/7/2024 in #help
error: cannot use column reference in DEFAULT expression
in this schema:
export const courses = createTable('courses', {
id: text('cuid').primaryKey().$defaultFn(() => createId()),
subjectId: text('subject_id').notNull(),
name: text('name').notNull(),
isPublic: boolean('is_public').default(false).notNull(),
imageUrl: text('image_url').default('/placeholder.png').notNull(),
unitLength: serial("unit_length").default(0).notNull(),
description: text('description').notNull()
},
(t) => ({
isPublicIdx: index('isPublicCourseIdx').on(t.isPublic),
})
);
export const courses = createTable('courses', {
id: text('cuid').primaryKey().$defaultFn(() => createId()),
subjectId: text('subject_id').notNull(),
name: text('name').notNull(),
isPublic: boolean('is_public').default(false).notNull(),
imageUrl: text('image_url').default('/placeholder.png').notNull(),
unitLength: serial("unit_length").default(0).notNull(),
description: text('description').notNull()
},
(t) => ({
isPublicIdx: index('isPublicCourseIdx').on(t.isPublic),
})
);
I am trying to add unitLength, but it's throwing this error when I have a default value, I get the same error with an integer.
drizzle-kit: v0.22.8
drizzle-orm: v0.31.2

No config path provided, using default path
Reading config file '/home/blue/Projects/ocw-final/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
error: cannot use column reference in DEFAULT expression
at /home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/node_modules/drizzle-kit/bin.c
js:77696:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (/home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/node_modul
es/drizzle-kit/bin.cjs:119635:26)
at async pgPush (/home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/node_modules/dri
zzle-kit/bin.cjs:122560:13)
at async _Command.<anonymous> (/home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/no
de_modules/drizzle-kit/bin.cjs:129681:7) {
length: 116,
severity: 'ERROR',
code: '0A000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_expr.c',
line: '563',
routine: 'transformColumnRef'
}
drizzle-kit: v0.22.8
drizzle-orm: v0.31.2

No config path provided, using default path
Reading config file '/home/blue/Projects/ocw-final/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
error: cannot use column reference in DEFAULT expression
at /home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/node_modules/drizzle-kit/bin.c
js:77696:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (/home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/node_modul
es/drizzle-kit/bin.cjs:119635:26)
at async pgPush (/home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/node_modules/dri
zzle-kit/bin.cjs:122560:13)
at async _Command.<anonymous> (/home/blue/Projects/ocw-final/node_modules/.pnpm/drizzle-kit@0.22.8/no
de_modules/drizzle-kit/bin.cjs:129681:7) {
length: 116,
severity: 'ERROR',
code: '0A000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_expr.c',
line: '563',
routine: 'transformColumnRef'
}
7 replies
TTCTheo's Typesafe Cult
Created by Ani on 4/24/2024 in #questions
Am I being lowballed?
No description
52 replies
TTCTheo's Typesafe Cult
Created by Ani on 4/12/2024 in #questions
Next Auth google says redirect URI is broken but works on another project
Hi! I am working on a project and I keep getting the error: Access blocked: This app’s request is invalid You can’t sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error If you are a developer of this app, see error details. Error 400: redirect_uri_mismatch but everything in configured directly, and added a temporary domain to the google console and deployed to vercel it does not give me the error, same credentials different code. Works in dev
8 replies
TTCTheo's Typesafe Cult
Created by Ani on 4/11/2024 in #questions
Date being overridden in neon and drizzle orm
Hey! when I'm trying to store a date in drizzle orm and neon the date that's being written is overwritten here is the table:
export const meetings = pgTable(
"meeting",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
isEvent: boolean("isEvent").notNull().default(false),
location: varchar("location", { length: 256 }),
isPublic: boolean("isPublic").notNull().default(false),
isRequired: boolean("isRequired").notNull().default(false),
link: text("link"),
date: date("date", {
mode: "date",
}).notNull(),
createdById: varchar("createdById", { length: 255 })
.notNull(),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt"),
},
(example) => ({
createdByIdIdx: index("userCreatedBy_idx").on(example.createdById),
nameIndex: index("name_idx").on(example.name),
dateIndex: index("date_idx").on(example.date),
})
);


export const attendedMeetings = pgTable(
"attended_meetings",
{
userId: varchar("userId", { length: 255 })
.notNull()
.references(() => users.id),
meetingId: integer("meetingId")
.notNull()
.references(() => meetings.id),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
},
(example) => ({
pk: primaryKey({ columns: [example.userId, example.meetingId] }),
userIdIdx: index("userId_idx").on(example.userId),
meetingIdIdx: index("meetingId_idx").on(example.meetingId),
})
);
export const meetings = pgTable(
"meeting",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
isEvent: boolean("isEvent").notNull().default(false),
location: varchar("location", { length: 256 }),
isPublic: boolean("isPublic").notNull().default(false),
isRequired: boolean("isRequired").notNull().default(false),
link: text("link"),
date: date("date", {
mode: "date",
}).notNull(),
createdById: varchar("createdById", { length: 255 })
.notNull(),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt"),
},
(example) => ({
createdByIdIdx: index("userCreatedBy_idx").on(example.createdById),
nameIndex: index("name_idx").on(example.name),
dateIndex: index("date_idx").on(example.date),
})
);


export const attendedMeetings = pgTable(
"attended_meetings",
{
userId: varchar("userId", { length: 255 })
.notNull()
.references(() => users.id),
meetingId: integer("meetingId")
.notNull()
.references(() => meetings.id),
createdAt: timestamp("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
},
(example) => ({
pk: primaryKey({ columns: [example.userId, example.meetingId] }),
userIdIdx: index("userId_idx").on(example.userId),
meetingIdIdx: index("meetingId_idx").on(example.meetingId),
})
);
on the create tRPC endpoint:
create: adminProcedure
.input(createInput)
.mutation(async ({ ctx, input }) => {
// 2024-04 - 25T21: 30:00.000Z -> 2024-04 - 25T06:00:00.000Z (left = correct (what's being passed in), right = wrong but what's stored in db)
await ctx.db.insert(meetings).values(input)
}),
create: adminProcedure
.input(createInput)
.mutation(async ({ ctx, input }) => {
// 2024-04 - 25T21: 30:00.000Z -> 2024-04 - 25T06:00:00.000Z (left = correct (what's being passed in), right = wrong but what's stored in db)
await ctx.db.insert(meetings).values(input)
}),
Is there some default postgres behavior I am unaware of?
5 replies
TTCTheo's Typesafe Cult
Created by Ani on 3/24/2024 in #questions
Nextjs routing and layout inheritence issue
Hey I am having some trouble with layouts in nextjs: here is my file tree:
src/app
├── (dashboard)
│   ├── dashboard
│   │   └── [projectId]
│   │   ├── _components

│   │   ├── home
│   │   │   └── page.tsx
│   │   ├── layout.tsx
│   │   ├── sidebar.tsx
│   │   └── tasks
│   │   ├── CustomNode.tsx
│   │   ├── flow.tsx
│   │   └── page.tsx
│   └── layout.tsx

├── layout.tsx
src/app
├── (dashboard)
│   ├── dashboard
│   │   └── [projectId]
│   │   ├── _components

│   │   ├── home
│   │   │   └── page.tsx
│   │   ├── layout.tsx
│   │   ├── sidebar.tsx
│   │   └── tasks
│   │   ├── CustomNode.tsx
│   │   ├── flow.tsx
│   │   └── page.tsx
│   └── layout.tsx

├── layout.tsx
and the root layout.tsx is being inheritied in the dashboard page even though I have this in (dasboard)/layout.tsx
import React from 'react'
export default function DashboardRootLayout({ children }: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
import React from 'react'
export default function DashboardRootLayout({ children }: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
Maybe it's just because I am extreemly sleep deprived but I don't see what I am doing wrong here
19 replies
TTCTheo's Typesafe Cult
Created by Ani on 7/7/2023 in #questions
understanding drizzle insert
I am trying to use insert in drizzle orm and it is requiring the id for the model:
export const meetings = mysqlTable("meetings", {
id: varchar("id", { length: 255 }).notNull().primaryKey(),
clubId: varchar("clubId", { length: 255 }).notNull(),
name: varchar("name", { length: 255 }).notNull(),
description: varchar("description", { length: 255 }).notNull(),
image: varchar("image", { length: 255 }).notNull(),
isPublic: boolean("isPublic").default(false).notNull(),
date: timestamp("date", { mode: "date" }).notNull(),
});
export const meetings = mysqlTable("meetings", {
id: varchar("id", { length: 255 }).notNull().primaryKey(),
clubId: varchar("clubId", { length: 255 }).notNull(),
name: varchar("name", { length: 255 }).notNull(),
description: varchar("description", { length: 255 }).notNull(),
image: varchar("image", { length: 255 }).notNull(),
isPublic: boolean("isPublic").default(false).notNull(),
date: timestamp("date", { mode: "date" }).notNull(),
});
code:
create: protectedProcedure
.input(
z.object({
date: z.date(),
clubId: z.string(),
name: z.string(),
description: z.string(),
isPublic: z.boolean(),
image: z.string(),
})
)
.mutation(async ({ input, ctx }) => {
return await ctx.db.insert(meetings).values(input);
}),
create: protectedProcedure
.input(
z.object({
date: z.date(),
clubId: z.string(),
name: z.string(),
description: z.string(),
isPublic: z.boolean(),
image: z.string(),
})
)
.mutation(async ({ input, ctx }) => {
return await ctx.db.insert(meetings).values(input);
}),
error disperses when I add id to the schema, I was under the assumption that id is not required because it is auto generated?
6 replies
TTCTheo's Typesafe Cult
Created by Ani on 7/4/2023 in #questions
Drizzle many-to-many error
When running push from drizzle I am getting an error:
Error: target: db.-.primary: vttablet: rpc error: code = InvalidArgument desc = Duplicate column name 'user_id' (errno 1060) (sqlstate 42S21) (CallerID: ki0zccg3vsi73wcswazm): Sql: "create tab
le users_to_clubs (\n\tuser_id int not null,\n\tclub_id int not null,\n\tPRIMARY KEY (user_id, user_id)\n)", BindVars: {REDACTED}
at PromiseConnection.query (/home/blue/Clones/tr-clone/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:34740:26)
at Command.<anonymous> (/home/blue/Clones/tr-clone/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:52122:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ER_DUP_FIELDNAME',
errno: 1060,
sql: 'CREATE TABLE `users_to_clubs` (\n' +
'\t`user_id` int NOT NULL,\n' +
'\t`club_id` int NOT NULL,\n' +
'\tPRIMARY KEY(`user_id`,`user_id`)\n' +
');\n',
sqlState: '42S21',
sqlMessage: `target: db.-.primary: vttablet: rpc error: code = InvalidArgument desc = Duplicate column name 'user_id' (errno 1060) (sqlstate 42S21) (CallerID: ki0zccg3vsi73wcswazm): Sql: "cr
eate table users_to_clubs (\\n\\tuser_id int not null,\\n\\tclub_id int not null,\\n\\tPRIMARY KEY (user_id, user_id)\\n)", BindVars: {REDACTED}`
}
Error: target: db.-.primary: vttablet: rpc error: code = InvalidArgument desc = Duplicate column name 'user_id' (errno 1060) (sqlstate 42S21) (CallerID: ki0zccg3vsi73wcswazm): Sql: "create tab
le users_to_clubs (\n\tuser_id int not null,\n\tclub_id int not null,\n\tPRIMARY KEY (user_id, user_id)\n)", BindVars: {REDACTED}
at PromiseConnection.query (/home/blue/Clones/tr-clone/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:34740:26)
at Command.<anonymous> (/home/blue/Clones/tr-clone/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:52122:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ER_DUP_FIELDNAME',
errno: 1060,
sql: 'CREATE TABLE `users_to_clubs` (\n' +
'\t`user_id` int NOT NULL,\n' +
'\t`club_id` int NOT NULL,\n' +
'\tPRIMARY KEY(`user_id`,`user_id`)\n' +
');\n',
sqlState: '42S21',
sqlMessage: `target: db.-.primary: vttablet: rpc error: code = InvalidArgument desc = Duplicate column name 'user_id' (errno 1060) (sqlstate 42S21) (CallerID: ki0zccg3vsi73wcswazm): Sql: "cr
eate table users_to_clubs (\\n\\tuser_id int not null,\\n\\tclub_id int not null,\\n\\tPRIMARY KEY (user_id, user_id)\\n)", BindVars: {REDACTED}`
}
6 replies
TTCTheo's Typesafe Cult
Created by Ani on 5/21/2023 in #questions
increase LCP performance with t3 stack.
3 replies
TTCTheo's Typesafe Cult
Created by Ani on 5/8/2023 in #questions
audio setup recommendation
Hello everyone I am looking into investing into microphone(s) for making videos and conducting interviews. I have a few questions 1. For a interview/podcast scenario, I am thinking purchacing 2 microphones. Can I make do with 1? 2. After a bit of research I settled on the Samson q2u mic which is currently 50usd on amazon. At the prices range of 50-100$ is there a better value microphone?
2 replies
TTCTheo's Typesafe Cult
Created by Ani on 5/7/2023 in #questions
Formik, React-Datepicker error
I am getting TypeError: Cannot read properties of undefined (reading 'type') when I try to pick a date with the
<FormikDatePicker name="time" className='input' placeholder="Time" />
<FormikDatePicker name="time" className='input' placeholder="Time" />
the formik form
<Formik
initialValues={{
name: '',
points: 1,
image: 'https://placehold.co/600x400.png',
description: '',
time: new Date()


}}
onSubmit={(
values: Values,
{ resetForm }: FormikHelpers<Values>
) => {

mutate({
data: {
name: values.name,
points: values.points,
image: values.image,
description: values.description,
clubId: String(clubId),
time: values.time,


}

})
}}
>
<Formik
initialValues={{
name: '',
points: 1,
image: 'https://placehold.co/600x400.png',
description: '',
time: new Date()


}}
onSubmit={(
values: Values,
{ resetForm }: FormikHelpers<Values>
) => {

mutate({
data: {
name: values.name,
points: values.points,
image: values.image,
description: values.description,
clubId: String(clubId),
time: values.time,


}

})
}}
>
FormikDatePicker Component
import { useFormikContext } from "formik";
import React from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";

const FormikDatePicker = (props) => {
const formik = useFormikContext(); // or `const [field] = useField(props);`

return <DatePicker
timeLabelInput="Time:"
dateFormat="MMMM d, yyyy h:mm aa"
showTimeInput
onChange={formik.handleChange(props.name) /* or `field.onChange` */} {...props} />
}

export default FormikDatePicker;
import { useFormikContext } from "formik";
import React from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";

const FormikDatePicker = (props) => {
const formik = useFormikContext(); // or `const [field] = useField(props);`

return <DatePicker
timeLabelInput="Time:"
dateFormat="MMMM d, yyyy h:mm aa"
showTimeInput
onChange={formik.handleChange(props.name) /* or `field.onChange` */} {...props} />
}

export default FormikDatePicker;
I don't see why I'm getting the error
4 replies
TTCTheo's Typesafe Cult
Created by Ani on 4/18/2023 in #questions
keyboard purchase
I have a 100$ set aside to buy a keyboard. I'm thinking of the the Keychron k8 pro. Any thoughts or recommendations? First time mechanical keyboard so I don't know much. Sorry if I'm not allowed to ask a non tech related question, I'll take it down if it's against the rules.
20 replies
TTCTheo's Typesafe Cult
Created by Ani on 4/2/2023 in #questions
understanding <a> in nextjs
Hello I am a little confused about how links work in nextjs I am using the <a> tag. In the first image I use the <a> tag an get no errors but in the second image I get an error. any insight on why this is the case?
15 replies
TTCTheo's Typesafe Cult
Created by Ani on 3/20/2023 in #questions
Cheapest hosting service
Hey y'all I need to host a website, it's static for my blog and portfolio. I need the most cost effective hosting service. Any recommendations?
5 replies
TTCTheo's Typesafe Cult
Created by Ani on 3/12/2023 in #questions
google next-auth error: invalid_client even if client id is correct
my auth was working fine but now I keep getting this error [next-auth][error][OAUTH_CALLBACK_ERROR] https://next-auth.js.org/errors#oauth_callback_error invalid_client (Unauthorized) { error: OPError: invalid_client (Unauthorized) at processResponse (/home/blue/Projects/tracker/node_modules/openid-server.js:157:99 { name: 'OAuthCallbackError', code: undefined }, providerId: 'google', message: 'invalid_client (Unauthorized)' } (deleted some of the error)
12 replies