goofysystem
goofysystem
Explore posts from servers
HHono
Created by InvalidJoker on 7/14/2024 in #help
Cookies not available in other Route
ok in my case it was mismatch in host. My client(mobile app) was making a request to 127.0.0.1:8787 when getting the authorization url and setting the cookies. However, c.redirect sets the host as localhost:8787 and loses the cookies set for 127.0.0.1:8787. So cookies should work. I recommend logging the raw headers per request to see if anything is odd. Also I set the sameSite property as "Lax"
18 replies
HHono
Created by InvalidJoker on 7/14/2024 in #help
Cookies not available in other Route
Hey running into this issue as well. Based on this you should be able to pass cookies around during OAuth flow: https://github.com/lukesthl/expo-lucia-auth-example/blob/b5d664af7f54d080a56d67be249d3be3c1f5e265/apps/api/src/controller/auth/auth.controller.ts#L95 I have implemented something similar as above on Hono to run into the same issue of cookies being dropped when redirecting to callback from the provider authorization page. What is interesting is I have the same oauth flow that uses cookies on sveltekit that still works.
18 replies
DTDrizzle Team
Created by goofysystem on 7/28/2024 in #help
Getting SQLITE Constraint error with `foreign_keys off`
It seems that is no way to manipulate PRAGMA during migration with drizzle: https://github.com/drizzle-team/drizzle-orm/issues/1813 I even tried doing this to my migration setup to set foreign_keys as off but found no success:
import { migrate } from 'drizzle-orm/libsql/migrator';
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';

export const client = createClient({
url: process.env.TOURNAMENT_DB_URL as string,
authToken: process.env.TOURNAMENT_DB_AUTH_TOKEN as string,
});

export const db = drizzle(client);

async function main() {
try {
await client.execute('PRAGMA foreign_keys = OFF');
await migrate(db, {
migrationsFolder: './migrations',
});
await client.execute('PRAGMA foreign_keys = ON');
console.log('Tables migrated!');
process.exit(0);
} catch (error) {
console.error('Error performing migration: ', error);
process.exit(1);
}
}

main();
import { migrate } from 'drizzle-orm/libsql/migrator';
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';

export const client = createClient({
url: process.env.TOURNAMENT_DB_URL as string,
authToken: process.env.TOURNAMENT_DB_AUTH_TOKEN as string,
});

export const db = drizzle(client);

async function main() {
try {
await client.execute('PRAGMA foreign_keys = OFF');
await migrate(db, {
migrationsFolder: './migrations',
});
await client.execute('PRAGMA foreign_keys = ON');
console.log('Tables migrated!');
process.exit(0);
} catch (error) {
console.error('Error performing migration: ', error);
process.exit(1);
}
}

main();
2 replies
DTDrizzle Team
Created by romulan on 7/8/2024 in #help
how to set pragma foreign_keys = off, during migrations?
I'm having the same issue. Were you able to get this fixed? Upon digging maybe it is not possible with drizzle? Hope it gets solved bc I am tired of having to copy over the data of children tables when I alter table on a parent table: Github Issue on this: https://github.com/drizzle-team/drizzle-orm/issues/1813
2 replies
CDCloudflare Developers
Created by goofysystem on 3/17/2024 in #pages-help
Typesense search breaks the app when refreshing the page.
2 replies
DTDrizzle Team
Created by goofysystem on 1/13/2024 in #help
How to fetch with multiple ids
@Angelelz thank you!
8 replies
DTDrizzle Team
Created by goofysystem on 1/13/2024 in #help
How to fetch with multiple ids
The solution:
const ticketListingIds = [3,4];
const ticketListingRows = await orderDb
.select()
.from(ticketListing)
.where(sql`id in ${sql.raw(`(${ticketListingIds.join(',')})`)} and event_id = ${eventId}`);
const ticketListingIds = [3,4];
const ticketListingRows = await orderDb
.select()
.from(ticketListing)
.where(sql`id in ${sql.raw(`(${ticketListingIds.join(',')})`)} and event_id = ${eventId}`);
8 replies
DTDrizzle Team
Created by goofysystem on 1/13/2024 in #help
How to fetch with multiple ids
The first code block works now. I just need to make everything lowercase. But now...
// Returns two rows
const ticketListingRows = await orderDb
.select()
.from(ticketListing)
.where(sql`id in (3,4) and event_id = ${eventId}`);

// Returns no rows
const ticketListingIds = [3,4];
const ticketListingRows = await orderDb
.select()
.from(ticketListing)
.where(sql`id in (${ticketListingIds.join(',')}) and event_id = ${eventId}`);
// Returns two rows
const ticketListingRows = await orderDb
.select()
.from(ticketListing)
.where(sql`id in (3,4) and event_id = ${eventId}`);

// Returns no rows
const ticketListingIds = [3,4];
const ticketListingRows = await orderDb
.select()
.from(ticketListing)
.where(sql`id in (${ticketListingIds.join(',')}) and event_id = ${eventId}`);
8 replies
DTDrizzle Team
Created by goofysystem on 1/13/2024 in #help
How to fetch with multiple ids
and this does not work :/
const ticketListingIds = [3,4]
const ticketListingRows = await orderDb.run(
sql`select * from ticket_listing where id in (${ticketListingIds.join(', ')}) and event_id = ${eventId}`,
);
const ticketListingIds = [3,4]
const ticketListingRows = await orderDb.run(
sql`select * from ticket_listing where id in (${ticketListingIds.join(', ')}) and event_id = ${eventId}`,
);
8 replies
DTDrizzle Team
Created by goofysystem on 1/13/2024 in #help
How to fetch with multiple ids
So this works as expected
const ticketListingRows = await orderDb.run(
sql`select * from ticket_listing where id in (3, 4) and event_id = ${eventId}`,
);
const ticketListingRows = await orderDb.run(
sql`select * from ticket_listing where id in (3, 4) and event_id = ${eventId}`,
);
8 replies
CDCloudflare Developers
Created by goofysystem on 10/12/2023 in #pages-help
Sveltekit + Lucia: Error: The script will never generate a response.
The actual reason was connecting to @libsql/client/web with the wss:// instead of https://
2 replies
CDCloudflare Developers
Created by goofysystem on 9/13/2023 in #workers-help
403 Error using Turso in local development when running wrangler dev with `--remote` flag
@cyb3rjak3 I see so is --remote flag is just not recommended for local development? I use the flag to verify my R2 working and see the file show up on the dashboard. Does wrangler dev without --remote flag persist files being uploaded?
3 replies