Skip to content

Remote bindings not using preview D1 DB #10460

@TristanWiley

Description

@TristanWiley

What versions & operating system are you using?

System:
OS: macOS 15.6
CPU: (10) arm64 Apple M1 Pro
Memory: 362.25 MB / 16.00 GB
Shell: 4.0.2 - /opt/homebrew/bin/fish
Binaries:
Node: 22.18.0 - ~/.nvm/versions/node/v22.18.0/bin/node
Yarn: 3.6.3 - ~/.nvm/versions/node/v22.18.0/bin/yarn
npm: 10.9.3 - ~/.nvm/versions/node/v22.18.0/bin/npm
pnpm: 10.12.4 - ~/.nvm/versions/node/v22.18.0/bin/pnpm
bun: 1.2.4 - ~/.bun/bin/bun
npmPackages:
@cloudflare/vite-plugin: ^1.11.3 => 1.11.3
@cloudflare/workers-types: ^4.20230115.0 => 4.20250813.0

Please provide a link to a minimal reproduction

No response

Describe the Bug

I've setup the following, however for some reason the DB is pointing to my production D1 DB instead of my second one (I created a second as a preview). Any ideas why?

I run bun dev, and the DB still points to the production DB.

wrangler.jsonc

  "d1_databases": [
    {
      "binding": "DB",
      "database_name": "procity-core",
      "database_id": "uuid-1",
      "preview_database_id": "uuid-2",
      "experimental_remote": true
    }

and

vite.config.ts

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { cloudflare } from "@cloudflare/vite-plugin";

export default defineConfig({
  plugins: [
    react(),
    cloudflare({
      configPath: "./wrangler.jsonc",
      experimental: {
        remoteBindings: true,
      },
    }),
  ]
});

my package.json has these scripts

  "scripts": {
    "start": "wrangler dev --remote",
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "bun run build && vite preview",
    "deploy": "bun run build && wrangler deploy",
    "schema-gen": "drizzle-kit generate:sqlite",
    "lint": "eslint . --ext .ts,.tsx"
  }

Please provide any relevant error logs

No response

Metadata

Metadata

Labels

bugSomething that isn't workingvite-pluginRelating to the `@cloudflare/vite-plugin` package

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions