Liltripple_reid
Liltripple_reid
Explore posts from servers
DTDrizzle Team
Created by Liltripple_reid on 10/13/2024 in #help
Unable to use `push` or `studio` anymore
Really no idea what happened but all of a sudden I'm getting this messages when trying to run any of those commands
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/a3tech/Developer/personal_projects/nfc-portal/drizzle.config.ts'
[✓] Pulling schema from database...
Error: Transform failed with 1 error:
/Users/a3tech/Developer/personal_projects/nfc-portal/src/lib/utils.tsx:276:26: ERROR: Expected ">" but found "{"
at failureErrorWithLog (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1651:15)
at /Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:849:29
at responseCallbacks.<computed> (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:704:9)
at handleIncomingPacket (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:764:9)
at Socket.readFromStdout (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:680:7)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
errors: [
{
detail: undefined,
id: '',
location: [Object],
notes: [],
pluginName: '',
text: 'Expected ">" but found "{"'
}
],
warnings: []
}
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/a3tech/Developer/personal_projects/nfc-portal/drizzle.config.ts'
[✓] Pulling schema from database...
Error: Transform failed with 1 error:
/Users/a3tech/Developer/personal_projects/nfc-portal/src/lib/utils.tsx:276:26: ERROR: Expected ">" but found "{"
at failureErrorWithLog (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1651:15)
at /Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:849:29
at responseCallbacks.<computed> (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:704:9)
at handleIncomingPacket (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:764:9)
at Socket.readFromStdout (/Users/a3tech/Developer/personal_projects/nfc-portal/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:680:7)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
errors: [
{
detail: undefined,
id: '',
location: [Object],
notes: [],
pluginName: '',
text: 'Expected ">" but found "{"'
}
],
warnings: []
}
6 replies
TtRPC
Created by Liltripple_reid on 4/11/2024 in #❓-help
trpc optimistic updates causing data flicker
I'm trying to add optimistic updates to a calendar component but when the mutate function is called there's a flicker in the existing events
5 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 3/10/2024 in #questions
cookies are returned as `object Promise` from RSC
not sure why this happens but here I am, based on the docs you should just be able to get cookies from any RSCs by calling cookies().get(<name>) however for some reason this is failing for me.
// server-actions.ts
export const getLatestWorkspace = () => {
const store = cookies();
return store.get(RECENT_WORKSPACE_KEY)?.value;
};
// server-actions.ts
export const getLatestWorkspace = () => {
const store = cookies();
return store.get(RECENT_WORKSPACE_KEY)?.value;
};
now using this on a page like
const workspace = getLatestWorkspace();
console.log({ workspace });

// routes are from the nextjs-safe-navigation by lukemorales
if (done.success) {
redirect(routes.dashboard({ slug: workspace ?? "" })); // why is the final url is something like /%5Bobject%20Promise%5D ??????!!!
}
const workspace = getLatestWorkspace();
console.log({ workspace });

// routes are from the nextjs-safe-navigation by lukemorales
if (done.success) {
redirect(routes.dashboard({ slug: workspace ?? "" })); // why is the final url is something like /%5Bobject%20Promise%5D ??????!!!
}
the cookies DO NOT have the SameSite nor HttpOnly options set
2 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 3/9/2024 in #questions
June Analytics weird error when attempting to track
so I'm trying to use the june SDK for nodeJS on a fastify app, but I always get this error when trying to analytics.identify a user, has someone else had something similar?
[16:19:14 UTC] INFO: request completed
[backend] reqId: "req-6"
[backend] res: {
[backend] "statusCode": 400
[backend] }
[backend] responseTime: 20.25774999987334
[backend] [16:19:14 UTC] ERROR: .userId/anonymousId/previousId/groupId is not a string
[backend] err: {
[backend] "type": "Error",
[backend] "message": ".userId/anonymousId/previousId/groupId is not a string",
[backend] "stack":
[backend] Error: .userId/anonymousId/previousId/groupId is not a string
[backend] at new ValidationError (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/validation/errors.ts:5:5)
[backend] at assertUserIdentity (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/validation/assertions.ts:19:11)
[backend] at validateEvent (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/validation/assertions.ts:71:3)
[backend] at NodeEventFactory.EventFactory.normalize (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/events/index.ts:277:18)
[16:19:14 UTC] INFO: request completed
[backend] reqId: "req-6"
[backend] res: {
[backend] "statusCode": 400
[backend] }
[backend] responseTime: 20.25774999987334
[backend] [16:19:14 UTC] ERROR: .userId/anonymousId/previousId/groupId is not a string
[backend] err: {
[backend] "type": "Error",
[backend] "message": ".userId/anonymousId/previousId/groupId is not a string",
[backend] "stack":
[backend] Error: .userId/anonymousId/previousId/groupId is not a string
[backend] at new ValidationError (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/validation/errors.ts:5:5)
[backend] at assertUserIdentity (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/validation/assertions.ts:19:11)
[backend] at validateEvent (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/validation/assertions.ts:71:3)
[backend] at NodeEventFactory.EventFactory.normalize (/Users/a3tech/Developer/islands/clientsquare/backend/node_modules/@segment/analytics-core/src/events/index.ts:277:18)
3 replies
TtRPC
Created by Liltripple_reid on 3/4/2024 in #❓-help
persistedQueries & indexedDb
Would like to know if someone else has tried out the feature and/if got it work, I'm trying to recreate the Linear's approach to it's snappy feel and all-data-ready on initial page loads. This is the current implementation I have following the RTK docs
// IDB custom persister
import { type PersistedClient, type Persister } from "@tanstack/react-query-persist-client";
import { del, get, set } from "idb-keyval";

/**
* Creates an Indexed DB persister
* @see https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
*/
export function createIDBPersister(idbValidKey: IDBValidKey = "reactQuery") {
return {
persistClient: async (client: PersistedClient) => {
await set(idbValidKey, client);
},
restoreClient: async () => {
return await get<PersistedClient>(idbValidKey);
},
removeClient: async () => {
await del(idbValidKey);
},
} as Persister;
}
// IDB custom persister
import { type PersistedClient, type Persister } from "@tanstack/react-query-persist-client";
import { del, get, set } from "idb-keyval";

/**
* Creates an Indexed DB persister
* @see https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
*/
export function createIDBPersister(idbValidKey: IDBValidKey = "reactQuery") {
return {
persistClient: async (client: PersistedClient) => {
await set(idbValidKey, client);
},
restoreClient: async () => {
return await get<PersistedClient>(idbValidKey);
},
removeClient: async () => {
await del(idbValidKey);
},
} as Persister;
}
4 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 1/23/2024 in #questions
slower session lookup in prod than local
No description
4 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 1/8/2024 in #questions
drizzle adapter failing
a newly scaffolded project gave this error on auth.ts
Type 'import("/Users/a3tech/Developer/personal_projects/pathways/node_modules/.pnpm/@[email protected]/node_modules/@auth/core/adapters").Adapter' is not assignable to type 'import("/Users/a3tech/Developer/personal_projects/pathways/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/adapters").Adapter'.
Types of property 'createUser' are incompatible.
Type '((user: AdapterUser) => Awaitable<AdapterUser>) | undefined' is not assignable to type '((user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>) | undefined'.
Type '(user: AdapterUser) => Awaitable<AdapterUser>' is not assignable to type '(user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>'.
Types of parameters 'user' and 'user' are incompatible.
Property 'id' is missing in type 'Omit<AdapterUser, "id">' but required in type 'AdapterUser'.ts(2322)
Type 'import("/Users/a3tech/Developer/personal_projects/pathways/node_modules/.pnpm/@[email protected]/node_modules/@auth/core/adapters").Adapter' is not assignable to type 'import("/Users/a3tech/Developer/personal_projects/pathways/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/adapters").Adapter'.
Types of property 'createUser' are incompatible.
Type '((user: AdapterUser) => Awaitable<AdapterUser>) | undefined' is not assignable to type '((user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>) | undefined'.
Type '(user: AdapterUser) => Awaitable<AdapterUser>' is not assignable to type '(user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>'.
Types of parameters 'user' and 'user' are incompatible.
Property 'id' is missing in type 'Omit<AdapterUser, "id">' but required in type 'AdapterUser'.ts(2322)
6 replies
TtRPC
Created by Liltripple_reid on 10/23/2023 in #❓-help
force-cache planetscale error
trying to use the trpc API from RSCs fails and gives the following error
result: {
data: {
secret: null,
error: [Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store']
}
},
elapsedMs: 14
result: {
data: {
secret: null,
error: [Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store']
}
},
elapsedMs: 14
4 replies
DTDrizzle Team
Created by Liltripple_reid on 10/23/2023 in #help
planetscale cache error
not sure if the issue is from drizzle or trpc, but trying to query the db via the RSC api fails with this error
result: {
data: {
secret: null,
error: [Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store']
}
},
elapsedMs: 14
result: {
data: {
secret: null,
error: [Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store']
}
},
elapsedMs: 14
8 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 10/22/2023 in #questions
error with NextSSRPlugin
getting weird SSR/hydration related errors when using it with react-hook-form
Warning: Prop `accept` did not match. Server: "" Client: "image/*"
at input
at label
at div
at UploadButton (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@uploadthing/react/dist/index.mjs:71:59)
at div
at form
at FormProvider (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected]/node_modules/react-hook-form/dist/index.esm.mjs:182:13)
at SettingsForm (webpack-internal:///(app-pages-browser)/./src/components/my/SettingsForm.tsx:52:11)
at Suspense
at section
at main
at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/not-found-boundary.js:62:11)
at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/layout-router.js:338:11)
Warning: Prop `accept` did not match. Server: "" Client: "image/*"
at input
at label
at div
at UploadButton (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@uploadthing/react/dist/index.mjs:71:59)
at div
at form
at FormProvider (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected]/node_modules/react-hook-form/dist/index.esm.mjs:182:13)
at SettingsForm (webpack-internal:///(app-pages-browser)/./src/components/my/SettingsForm.tsx:52:11)
at Suspense
at section
at main
at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/not-found-boundary.js:62:11)
at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/layout-router.js:338:11)
2 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 10/22/2023 in #questions
upload multiple files with UploadDropzone
how can I upload multiple images thru this component? I saw there's an option on the component that says
config={{
appendOnPaste: true,
}}
config={{
appendOnPaste: true,
}}
but not sure if it does what I'm looking for
2 replies
DTDrizzle Team
Created by Liltripple_reid on 10/6/2023 in #help
connection error, fetch failed
not sure if this issue comes from drizzle or planetscale but I'm getting this error while trying to do any queries from my db while on local dev
{
e: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async postJSON (file:///Users/a3tech/Developer/personal_projects/remarkable/node_modules/.pnpm/@[email protected]/node_modules/@planetscale/database/dist/index.js:128:22)
at async Connection.execute (file:///Users/a3tech/Developer/personal_projects/remarkable/node_modules/.pnpm/@[email protected]/node_modules/@planetscale/database/dist/index.js:86:23)
at async PlanetScalePreparedQuery.execute
cause: [Error: 0093F4DB01000000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355:
] {
library: 'SSL routines',
reason: 'wrong version number',
code: 'ERR_SSL_WRONG_VERSION_NUMBER'
}
}
{
e: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async postJSON (file:///Users/a3tech/Developer/personal_projects/remarkable/node_modules/.pnpm/@[email protected]/node_modules/@planetscale/database/dist/index.js:128:22)
at async Connection.execute (file:///Users/a3tech/Developer/personal_projects/remarkable/node_modules/.pnpm/@[email protected]/node_modules/@planetscale/database/dist/index.js:86:23)
at async PlanetScalePreparedQuery.execute
cause: [Error: 0093F4DB01000000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355:
] {
library: 'SSL routines',
reason: 'wrong version number',
code: 'ERR_SSL_WRONG_VERSION_NUMBER'
}
}
10 replies
TtRPC
Created by Liltripple_reid on 10/5/2023 in #❓-help
anyone else getting a failed to fetch in latest next versions
not sure if this is happening to more people, I tried literally everything, changing to 127.0.01, updating next@canary, not sure if the error is on trpc side, no logs shown, but man I'm completely blocked by this.
✓ Compiled /secrets/page in 483ms (1262 modules)
⨯ Internal error: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
⨯ Internal error: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
digest: "956933652"
✓ Compiled /secrets/page in 483ms (1262 modules)
⨯ Internal error: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
⨯ Internal error: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
digest: "956933652"
PD: I'm using kirimase to generate the code, not sure if that could be an issue
2 replies
TTCTheo's Typesafe Cult
Created by Liltripple_reid on 9/9/2023 in #questions
problems with next route interception
No description
4 replies
DTDrizzle Team
Created by Liltripple_reid on 9/8/2023 in #help
many to many relation problems
I'm using planetscale and can't seem to figure out what is wrong with this relation. There's no autocompletion for with when using the RQB and trying to access the table manually throws an referenced table error
// schema
export const organizations = mysqlTable("organizations", {
id: varchar("id", { length: 36 }).notNull().primaryKey(),
name: varchar("name", { length: 255 }).notNull(),
handle: varchar("handle", { length: 255 }).notNull().unique(),
plan: mysqlEnum("plan", ["free", "scaler", "enterprise", "custom"])
.notNull()
.default("free"),
ownerId: varchar("admin_id", { length: 36 }).notNull().unique(),
avatarURL: varchar("avatar", { length: 255 }),
createdAt: timestamp("created_at", {
fsp: 5,
}).defaultNow(),
});

export const organizationToUsers = mysqlTable(
"organization_to_users",
{
organizationId: varchar("organization_id", { length: 36 }).notNull(),
userId: varchar("user_id", { length: 36 }).notNull(),
},
(t) => ({
pk: primaryKey(t.organizationId, t.userId),
})
);

/**
* ========== MANY-TO-MANY relations for organizations and users ==========
*/
export const organizationRelation = relations(
organizations,
({ many, one }) => ({
owner: one(users, {
fields: [organizations.ownerId],
references: [users.id],
}),
members: many(organizationToUsers),
})
);

export const usersRelation = relations(users, ({ many }) => ({
organizationToUsers: many(organizationToUsers),
}));

export const organizationToUsersRelation = relations(
organizationToUsers,
({ one }) => ({
organization: one(organizations, {
fields: [organizationToUsers.organizationId],
references: [organizations.id],
}),
user: one(users, {
fields: [organizationToUsers.userId],
references: [users.id],
}),
})
);
// schema
export const organizations = mysqlTable("organizations", {
id: varchar("id", { length: 36 }).notNull().primaryKey(),
name: varchar("name", { length: 255 }).notNull(),
handle: varchar("handle", { length: 255 }).notNull().unique(),
plan: mysqlEnum("plan", ["free", "scaler", "enterprise", "custom"])
.notNull()
.default("free"),
ownerId: varchar("admin_id", { length: 36 }).notNull().unique(),
avatarURL: varchar("avatar", { length: 255 }),
createdAt: timestamp("created_at", {
fsp: 5,
}).defaultNow(),
});

export const organizationToUsers = mysqlTable(
"organization_to_users",
{
organizationId: varchar("organization_id", { length: 36 }).notNull(),
userId: varchar("user_id", { length: 36 }).notNull(),
},
(t) => ({
pk: primaryKey(t.organizationId, t.userId),
})
);

/**
* ========== MANY-TO-MANY relations for organizations and users ==========
*/
export const organizationRelation = relations(
organizations,
({ many, one }) => ({
owner: one(users, {
fields: [organizations.ownerId],
references: [users.id],
}),
members: many(organizationToUsers),
})
);

export const usersRelation = relations(users, ({ many }) => ({
organizationToUsers: many(organizationToUsers),
}));

export const organizationToUsersRelation = relations(
organizationToUsers,
({ one }) => ({
organization: one(organizations, {
fields: [organizationToUsers.organizationId],
references: [organizations.id],
}),
user: one(users, {
fields: [organizationToUsers.userId],
references: [users.id],
}),
})
);
9 replies
DTDrizzle Team
Created by Liltripple_reid on 9/6/2023 in #help
drizzle-zod failing
the createInsertSchema function is throwing errors when being used with @hookform/resolvers/zod, it's weird
// Form component
...
const form = useForm<NewComputer>({
resolver: zodResolver(insertComputerSchema),
});
...
// Form component
...
const form = useForm<NewComputer>({
resolver: zodResolver(insertComputerSchema),
});
...
throws this
Argument of type 'ZodObject<{ id: ZodString; brand: ZodString; cores: ZodNumber; }, UnknownKeysParam, ZodTypeAny, { id: string; brand: string; cores: number; }, { ...; }>' is not assignable to parameter of type 'ZodType<any, any, any>'.
The types of 'refine(...)._def.typeName' are incompatible between these types.
Type 'Zod.ZodFirstPartyTypeKind.ZodEffects' is not assignable to type
Argument of type 'ZodObject<{ id: ZodString; brand: ZodString; cores: ZodNumber; }, UnknownKeysParam, ZodTypeAny, { id: string; brand: string; cores: number; }, { ...; }>' is not assignable to parameter of type 'ZodType<any, any, any>'.
The types of 'refine(...)._def.typeName' are incompatible between these types.
Type 'Zod.ZodFirstPartyTypeKind.ZodEffects' is not assignable to type
schema and insertSchema declarations
export const computers = mysqlTable("computers", {
id: varchar("id", { length: 36 }).notNull().primaryKey(),
brand: varchar("brand", { length: 256 }).notNull(),
cores: int("cores").notNull(),
});

// Schema for CRUD - used to validate API requests
export const insertComputerSchema = createInsertSchema(computers);
export const computers = mysqlTable("computers", {
id: varchar("id", { length: 36 }).notNull().primaryKey(),
brand: varchar("brand", { length: 256 }).notNull(),
cores: int("cores").notNull(),
});

// Schema for CRUD - used to validate API requests
export const insertComputerSchema = createInsertSchema(computers);
2 replies
DTDrizzle Team
Created by Liltripple_reid on 9/4/2023 in #help
drizzle asks for <table> `id` when doing insert
I guess the ID should be autogenerated by the database itself, but not sure why it's asking me to pass it as a value when doing
// This throwns TS error saying that ID is missing
const data = await db.insert(workspaces).values([
{
ownerId: session.user.id,
company: parsed.data.company,
name: parsed.data.name,
},
]);
// This throwns TS error saying that ID is missing
const data = await db.insert(workspaces).values([
{
ownerId: session.user.id,
company: parsed.data.company,
name: parsed.data.name,
},
]);
using mysql, @planetscale/database my schemas:
export const workspaces = mysqlTable("workspaces", {
id: varchar("id", { length: 255 }).primaryKey(),
name: varchar("name", { length: 255 }).notNull(),
company: varchar("company", { length: 255 }).notNull(),
ownerId: varchar("ownerId", { length: 255 }).notNull(),
createdAt: timestamp("createdAt", { mode: "date" }).notNull().defaultNow(),
});

export const workspacesPickedSchema = createInsertSchema(workspaces)
.pick({
name: true,
company: true,
})
.required();
export const workspaces = mysqlTable("workspaces", {
id: varchar("id", { length: 255 }).primaryKey(),
name: varchar("name", { length: 255 }).notNull(),
company: varchar("company", { length: 255 }).notNull(),
ownerId: varchar("ownerId", { length: 255 }).notNull(),
createdAt: timestamp("createdAt", { mode: "date" }).notNull().defaultNow(),
});

export const workspacesPickedSchema = createInsertSchema(workspaces)
.pick({
name: true,
company: true,
})
.required();
5 replies
TtRPC
Created by Liltripple_reid on 9/4/2023 in #❓-help
useMutation throwing 500 errors
No description
12 replies
TtRPC
Created by Liltripple_reid on 8/25/2023 in #❓-help
`createCaller` and RSC - with next-auth
I've been upgrading my trpc routers and handlers to support edge+app router with drizzle and next-auth; and something that has come up is the use of createCaller (with createTRPCNext instead of createTRPCReact - and without the TRPCProvider). So I wanted to ask if this is a correct way of using that function
// app/_trpc/server-client.tsx
import { type Session } from "next-auth";
import { appRouter } from "~/server/api/root";

export const serverClient = ({ session }: { session: Session | null }) => {
return appRouter.createCaller({ session });
};
// app/_trpc/server-client.tsx
import { type Session } from "next-auth";
import { appRouter } from "~/server/api/root";

export const serverClient = ({ session }: { session: Session | null }) => {
return appRouter.createCaller({ session });
};
6 replies
DTDrizzle Team
Created by Liltripple_reid on 8/18/2023 in #help
planetscale
simple question, is the mode: planetscale in the drizzle-orm connection builder deprecated? doesn't seem to exist there anymore
3 replies