dsds10
dsds10
Explore posts from servers
CDCloudflare Developers
Created by dsds10 on 4/9/2025 in #workers-help
Deploy to Cloudflare produces invalid wrangler.json configuration
I was thrilled to read that the deploy button auto provisions required resources, so I tried to deploy a worker, but the experience isn't all that great unfortunately. I ran into many errors like "Invalid bucket name" and then "xy already exists" because the wizard is not cleanup up on failure. After many attempts using only "-" or "_" in names, I tried without any special characters and it finally deployed! But it's not working, because the produced configuration is invalid:
{
/* ... */
"d1_bknddatabases": [
{
"binding": "DB",
"bknddatabase_name": "bknddata",
"bknddatabase_id": "<redacted>"
}
],
"r2_bkndbuckets": [
{
"binding": "BUCKET",
"bkndbucket_name": "bkndbucket"
}
]
}
{
/* ... */
"d1_bknddatabases": [
{
"binding": "DB",
"bknddatabase_name": "bknddata",
"bknddatabase_id": "<redacted>"
}
],
"r2_bkndbuckets": [
{
"binding": "BUCKET",
"bkndbucket_name": "bkndbucket"
}
]
}
The template is here: https://github.com/dswbx/bknd-cloudflare-deploy Here are some attempts: 1, 2, 3 Found it that it works with wrangler.jsonc, here is the first successful attempt Would be nice to get some more description about the do's and don'ts when using this button 🙂
2 replies
DTDrizzle Team
Created by dsds10 on 10/20/2023 in #help
Planetscale db:push has issues with default values
Warning You are about to execute current statements:

ALTER TABLE `comments` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `comments` MODIFY COLUMN `updated_at` timestamp DEFAULT (now());
ALTER TABLE `follows` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `media` MODIFY COLUMN `metadata` json DEFAULT ('{}');
ALTER TABLE `media` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `media` MODIFY COLUMN `updated_at` timestamp DEFAULT (now());
ALTER TABLE `post_actions` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `posts` MODIFY COLUMN `created_at` timestamp NOT NULL DEFAULT (now());
ALTER TABLE `posts` MODIFY COLUMN `updated_at` timestamp NOT NULL DEFAULT (now());
ALTER TABLE `users` MODIFY COLUMN `is_creator` boolean NOT NULL;
ALTER TABLE `users` MODIFY COLUMN `is_creator` boolean NOT NULL DEFAULT false;
ALTER TABLE `users` MODIFY COLUMN `gender` text NOT NULL DEFAULT ('other');
ALTER TABLE `users` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `users` MODIFY COLUMN `updated_at` timestamp DEFAULT (now());
Warning You are about to execute current statements:

ALTER TABLE `comments` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `comments` MODIFY COLUMN `updated_at` timestamp DEFAULT (now());
ALTER TABLE `follows` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `media` MODIFY COLUMN `metadata` json DEFAULT ('{}');
ALTER TABLE `media` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `media` MODIFY COLUMN `updated_at` timestamp DEFAULT (now());
ALTER TABLE `post_actions` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `posts` MODIFY COLUMN `created_at` timestamp NOT NULL DEFAULT (now());
ALTER TABLE `posts` MODIFY COLUMN `updated_at` timestamp NOT NULL DEFAULT (now());
ALTER TABLE `users` MODIFY COLUMN `is_creator` boolean NOT NULL;
ALTER TABLE `users` MODIFY COLUMN `is_creator` boolean NOT NULL DEFAULT false;
ALTER TABLE `users` MODIFY COLUMN `gender` text NOT NULL DEFAULT ('other');
ALTER TABLE `users` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `users` MODIFY COLUMN `updated_at` timestamp DEFAULT (now());
Just tried to update my database, was prototyping it for some time, and thought I should sync it again (actually to add a property). Now I can see that there are a lot of default sets (unnecessary, as they are like so in the db), and especially the ones for "timestamp" are not working. Repeatidly getting error for an invalid default value:
target: hush.-.primary: vttablet: rpc error: code = InvalidArgument desc = Invalid default value for 'created_at' (errno 1067) (sqlstate 42000) (CallerID: y4tgjk3s3x4hy562qtn7): Sql: "alter table posts modify column updated_at timestamp not null default (now())", BindVars: {REDACTED}
target: hush.-.primary: vttablet: rpc error: code = InvalidArgument desc = Invalid default value for 'created_at' (errno 1067) (sqlstate 42000) (CallerID: y4tgjk3s3x4hy562qtn7): Sql: "alter table posts modify column updated_at timestamp not null default (now())", BindVars: {REDACTED}
Even if I manually modify the database hoping drizzle-kit would then forget these updates, it doesn't work. Running all on drizzle's latest versions.
4 replies