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"
      }
   ]
}

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 ๐Ÿ™‚
Was this page helpful?