Cory
Cory
Explore posts from servers
CDCloudflare Developers
Created by Cory on 4/12/2024 in #pages-help
How to enable unsafe binding in config
I am getting this error: Configuration file for Pages projects does not support "unsafe"
5 replies
CDCloudflare Developers
Created by Cory on 4/10/2024 in #pages-help
Support for separate wrangler.toml files in monorepo?
When using the new wrangler.toml support with Pages and new mono-repo support, Cloudflare seems to only look for the wrangler.toml file at the root directory (even if root directory is manually changed). I would like to have a seperate wrangler.toml for each Pages project within my mono-repo.
1 replies
CDCloudflare Developers
Created by Cory on 4/10/2024 in #general-help
How do I use multiple wrangler.toml with different projects in a mono-repo?
When I have my wrangler.toml in the directory of my app aka... apps/site/wrangler.toml It does not seem to know it's there. Putting it in the root directory of the project works - but I want to have seperate wrangler tomls for different projects - how can I do this?
10 replies
DTDrizzle Team
Created by Cory on 2/27/2024 in #help
isNotNull() returning incorrect Type
The following code...
export const getItemsInTrash = db
.select()
.from(schema.item)
.where(and(eq(schema.item.id, sql.placeholder('id')), isNotNull(schema.item.trashedAt)))
.orderBy(desc(schema.item.updatedAt))
.prepare();
export const getItemsInTrash = db
.select()
.from(schema.item)
.where(and(eq(schema.item.id, sql.placeholder('id')), isNotNull(schema.item.trashedAt)))
.orderBy(desc(schema.item.updatedAt))
.prepare();
Returns an array of objects where "trashedAt" is a Date | Null but this is not possible because I am using where isNotNull()
1 replies
CDCloudflare Developers
Created by Cory on 2/12/2024 in #workers-help
When running fetch to transform an image, it ignoring the "format" but only within my code
If I navigate to the URL directly, it formats it to webp, but if I use 'fetch' from within my sveltekit function, it doesn't convert it - is there a reason for this?
6 replies
DTDrizzle Team
Created by Cory on 2/8/2024 in #help
If I pass an object with a property that has 'undefined' as the value, will it be ignored?
If I am updating or inserting data and passing an object, for instance:
const dbData = {
id: undefined,
name: 'foo'
}
const dbData = {
id: undefined,
name: 'foo'
}
Will ID be ignored and not set?
3 replies
CDCloudflare Developers
Created by Cory on 2/1/2024 in #workers-help
Not image transforms not support transforming a AVIF image as the source?
Wondering whether I should accept AVIF image files, but it seems like it's not supported when trying to transform it
3 replies
CDCloudflare Developers
Created by Cory on 1/25/2024 in #general-help
Why does "service bindings" link go to D1 page
No description
1 replies
CDCloudflare Developers
Created by Cory on 12/12/2023 in #general-help
Can't access worker "route" from inside SvelteKit worker function
I have a worker that uploads images to R2, and I call it via a fetch via an API route in my SvelteKit application. I have a custom "route" assigned to it, that is in the same zone as the SvelteKit application (hosted on Cloudflare). It only works when I fetch the original URL .workers.dev, and not the custom one I have set up which is essentially site.com/image-upload/* even though if I go tot he URL via the browser, it works fine. is there a solution i ammissing here?
4 replies
DTDrizzle Team
Created by Cory on 10/20/2023 in #help
How to select all from a table and get the the columns names returned as they are stored?
I want to do a select() query on my user table to get emailVerified: boolean('email_verified').default(false).notNull(), What is returning is emailVerified as opposed to email_verified. I want to return the latter, but also all the rest of the columns. I know I could do this:
.select({
id: user.id,
email: user.email,
email_verified: user.emailVerified
})
.select({
id: user.id,
email: user.email,
email_verified: user.emailVerified
})
But then if I add anything to the user table, I now have to add it to the select statement, where I might forget. Is there a way to say get ALL columns but return email_verified as actually email_verified? Or return all columns with their actual column names, as opposed to the Drizzle version?
6 replies
CDCloudflare Developers
Created by Cory on 10/11/2023 in #workers-help
How to enable logpush with Cloudflare and SvelteKit?
Is there someway with the Cloudflare adapter with SvelteKit to enable logpush?
11 replies
DTDrizzle Team
Created by Cory on 9/6/2023 in #help
How to updateNow for datetime?
How can I automatically update a datetime when the row is updated for mySQL?
4 replies
DTDrizzle Team
Created by Cory on 7/30/2023 in #help
Is there a way to easily convert existing schema's to different DB type?
I have a mySQL schema currently, but wanted to try out libSQL via Turso, but didn't want to have go through my entire schema and queries and change them all manually. Is there some easier way to do this?
1 replies
CDCloudflare Developers
Created by Cory on 7/27/2023 in #general-help
Any particular reason my image-resized would have have no age ?
Using the image-resizer via URL and getting blank for the age
1 replies
DTDrizzle Team
Created by Cory on 7/27/2023 in #help
Difference in using unique() on the column definition vs the index?
What is the different between using something like name: varchar('name', { length: 256 }).unique() vs (t) => ({ unq: unique().on(t.name), }));)
4 replies
CDCloudflare Developers
Created by Cory on 7/26/2023 in #general-help
Why is cloudflare image res-sizing not being properly cached?
I was recently using Cloudflare image re-sizing and using a non-origin s3 link for the resize targets. I then got a cname for the s3 bucket and used a cname record so the images are not run through cloudflare. It stil seems the images are not being cached long enough
4 replies
DTDrizzle Team
Created by Cory on 6/30/2023 in #help
It is possible to have prepared statements inside transactions?
Is there a way to insert prepared queries inside a transaction ?
2 replies
DTDrizzle Team
Created by Cory on 6/20/2023 in #help
Is there a way to save the generated response Type from a query?
I see that when you hover over the type for the response of a query, you can see what data will be returned. Is there a way to extract, or save that Type somehow, so I can use it elsewhere?
16 replies
DTDrizzle Team
Created by Cory on 5/25/2023 in #help
Help with this relational query?
I am trying to get all the organizations that a member is associated with. This code is working:
await db.query.membership.findMany({
columns: {},
where: eq(membership.userId, sessionUser.userId),
with: {
organization: true
}
});
await db.query.membership.findMany({
columns: {},
where: eq(membership.userId, sessionUser.userId),
with: {
organization: true
}
});
But it is outputting this:
[
{ organization: { id: 19, name: "Testing123" } },
{ organization: { id: 20, name: 'test' } },
{ organization: { id: 21, name: 'Place 4012 } },
{ organization: { id: 22, name: 'Foo' } }
]
[
{ organization: { id: 19, name: "Testing123" } },
{ organization: { id: 20, name: 'test' } },
{ organization: { id: 21, name: 'Place 4012 } },
{ organization: { id: 22, name: 'Foo' } }
]
I know I could just transform this easily with JS, but I wonder if I writing the initial code wrong. I just want an array of organizations.
20 replies
DTDrizzle Team
Created by Cory on 5/10/2023 in #help
Type error for eq()
I get Expected 1 arguments, but got 2. in a statement like this:
.where(and(eq(menu.id, form.data.id)), eq(menu.userId, session.userId));
.where(and(eq(menu.id, form.data.id)), eq(menu.userId, session.userId));
4 replies