Efkan
Efkan
Explore posts from servers
DTDrizzle Team
Created by Efkan on 10/16/2024 in #help
Prisma to DrizzleORM Issue
Hi, I just switched to DrizzleORM in my hobby project which is a Remix App hosted at Vercel using Turso. Locally everything works fine, but when I deploy it to Vercel, I get the following error on login page.
TypeError: First parameter has member 'readable' that is not a ReadableStream.
at node:internal/deps/undici/undici:13178:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
TypeError: First parameter has member 'readable' that is not a ReadableStream.
at node:internal/deps/undici/undici:13178:13
at processTicksAndRejections (node:internal/process/task_queues:95:5)
My drizzle.config.ts :
import { config } from 'dotenv';
import { defineConfig } from 'drizzle-kit';

config({ path: '.env' });

export default defineConfig({
schema: './app/db/schema.ts',
out: './migrations',
dialect: 'turso',
dbCredentials: {
url: process.env.TURSO_DATABASE_URL!,
authToken: process.env.TURSO_AUTH_TOKEN!,
},
});
import { config } from 'dotenv';
import { defineConfig } from 'drizzle-kit';

config({ path: '.env' });

export default defineConfig({
schema: './app/db/schema.ts',
out: './migrations',
dialect: 'turso',
dbCredentials: {
url: process.env.TURSO_DATABASE_URL!,
authToken: process.env.TURSO_AUTH_TOKEN!,
},
});
My index.server.ts :
import { config } from 'dotenv';
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';
import * as schema from './schema.server';

config({ path: '.env' });

const client = createClient({
url: process.env.TURSO_DATABASE_URL!,
authToken: process.env.TURSO_AUTH_TOKEN!,
});

export const db = drizzle(client, { schema });
import { config } from 'dotenv';
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';
import * as schema from './schema.server';

config({ path: '.env' });

const client = createClient({
url: process.env.TURSO_DATABASE_URL!,
authToken: process.env.TURSO_AUTH_TOKEN!,
});

export const db = drizzle(client, { schema });
I'm having hard time to understand if this is a DrizzleORM issue or related to Remix on Vercel ? I was using Turso with Prisma and it was working fine by the way.
8 replies
TTCTheo's Typesafe Cult
Created by Efkan on 11/27/2023 in #questions
How to handle after form submit with Server Actions ?
Hello, I'm looking for the best way to know the form is succesfully submitted and a succesful response returned. I know about useFormState which works by passing an inital state and then updating the state in the server action. But, here's the problem. const [formState, formAction] = useFormState(editProvider, {success:null}); formState?.success // true after first response Form submitted, success is true. If you submit the form again success is still true so the state isnt updated. I want to close the dialog when the success is true even after resubmissions. How I can handle this without disabling progressive enhancement ?
3 replies
DTDrizzle Team
Created by Efkan on 10/18/2023 in #help
Check Constraint Workaround
I know there's a work in progress for check support in Drizzle https://github.com/drizzle-team/drizzle-orm/issues/880 But, is there way to make it work now with the Drizzle's sql operator ? I couldn't find any examples
1 replies
TTCTheo's Typesafe Cult
Created by Efkan on 10/13/2023 in #questions
Drizzle Schema Boolean
Hi everyone, I'm trying to create a schema in Drizzle but my SQL knowledge is pretty limited. I want to have a boolean like isProtected and if this is true then store some other information in other columns. I dont know how to handle a situation like this.
isProtected: boolean('is_protected').default(false).notNull(),
contentType: mysqlEnum('content_type', [
'application/vnd.apple.mpegurl',
'text/xml',
]),
contentUrl: text('content_url'),
isProtected: boolean('is_protected').default(false).notNull(),
contentType: mysqlEnum('content_type', [
'application/vnd.apple.mpegurl',
'text/xml',
]),
contentUrl: text('content_url'),
I want to have these contentType and contentUrl columns to contain value only when isProtected is true. Basically, Is there a way to make sure that when I set to isProtected true Typescript will force me to add other related columns ?
8 replies