Nick Harris
Nick Harris
Explore posts from servers
DTDrizzle Team
Created by Nick Harris on 1/21/2025 in #help
Find which migration is erroring when using the programmatic `migrate` function
I'm trying out PGLite for tests, where we use regular PG in production. I'm tracking down a error: cannot insert multiple commands into a prepared statement error, I assume there's an issue in one of the migrations. How can I find which migration specifically it's erroring on?
1 replies
DTDrizzle Team
Created by Nick Harris on 1/20/2025 in #help
Zod validation errors when moving from drizzle-kit 0.20.14 to 0.30.2
I'm working on updating the version of Drizzle we use. I've run drizzle-kit up and it updated all of the snapshot files, however I'm still getting validation errors when running the generate command to generate new migrations. It seems that every enum field is showing similar errors (there are hundreds). Here's an example from the array:
{
{
"code": "invalid_type",
"expected": "string",
"received": "object",
"path": [
"enums",
"[object Object].ProtectedAccountBehavior",
"schema"
],
"message": "Expected string, received object"
},
{
{
"code": "invalid_type",
"expected": "string",
"received": "object",
"path": [
"enums",
"[object Object].ProtectedAccountBehavior",
"schema"
],
"message": "Expected string, received object"
},
And in the snapshot JSON:
"public.ProtectedAccountBehavior": {
"name": "ProtectedAccountBehavior",
"schema": "public",
"values": [
"VIRTUAL_ACCOUNT",
"PROXY"
]
}
"public.ProtectedAccountBehavior": {
"name": "ProtectedAccountBehavior",
"schema": "public",
"values": [
"VIRTUAL_ACCOUNT",
"PROXY"
]
}
2 replies
DTDrizzle Team
Created by Nick Harris on 11/25/2024 in #help
Greater than comparisons with timestamp mode string
I'm getting type errors with the gte comparison operator on a timestamp column that has a mode of string. The mode should only affect the output data type of queries, not the type in the DB right?
3 replies
DTDrizzle Team
Created by Nick Harris on 10/10/2024 in #help
Subquery select without left join
Is it possible to select fields from a correlated subquery on a table without doing a LEFT JOIN? Drizzle keeps telling me that it needs to be in a JOIN, but I don't want to join.
1 replies
DTDrizzle Team
Created by Nick Harris on 6/21/2024 in #help
Custom aggregation column types
I have a custom column type with Drizzle for a monetary amount column (numeric PG type). The type is transformed into a "Big" type from a library, allowing me to do decimal-accurate math. However, in aggregations like sum, it goes back to being a string. Is there a way to write custom aggregations as well?
1 replies
CDCloudflare Developers
Created by Nick Harris on 1/23/2024 in #pages-help
Uploading assets for "direct deployment" CF Pages
We're building our CF page in our own service rather than using the CF build service. Our goal is to create a new (preview) deployment, retrieve the URL for that deplyoment (to use elsewhere), then upload the build assets to that deployment. How would we do that with the REST API? I see the docs for creating a new deployment, but now how to push build assets to it: https://developers.cloudflare.com/api/operations/pages-deployment-create-deployment
2 replies
CDCloudflare Developers
Created by Nick Harris on 1/18/2024 in #workers-help
Too many redirects when making fetch requests from a worker
When I make a fetch request from a CF Worker, I'm getting a "Too many redirects" error from the fetch. The redirect URLs aren't changing, each new location is the same URL as the previous. This only happens when making requests to the same domain that the worker lives on (different subdomain). When making a request manually from my device, there are no redirects. It happens with any URL on the same CF domain. For example, if my CF worker lives on worker.example.com. When I use fetch in the Worker to make a request to https://api.example.com/somepath, the Fetch errors out with an infinite redirect, where each redirect location is https://api.example.com/somepath. I can make manual requests to https://api.example.com/somepath from my device and do not see any redirects.
9 replies
CDCloudflare Developers
Created by Nick Harris on 5/12/2023 in #pages-help
Deploy a production vs preview build using GitHub Actions
I have a GitHub action setup to build a React project, then deploy using this GitHub action: https://github.com/marketplace/actions/cloudflare-pages-github-action When it deploys, it's deploying it as a preview build. How do I get it to deploy as a production build instead? The docs seem to indicate that I can specify which branch is the production branch, but I've looked all over the Page settings in CF and don't see that option. It seems to be missing.
1 replies