# Cloudflare Worker bindings not accepted

Just spent an hour debugging why my D1 database binding wasn't working. Here's what happened and what I learned:

**Symptoms I saw:**

- Bindings were not showing in the dashboard after `wrangler deploy`
- Even after adding the binding manually in Settings → they didn't appear
- Settings page showed: "Variables cannot be added to a Worker that only has static assets."
- Everything worked fine when I had the code in the Worker directly, but after switching to GitHub + wrangler.jsonc, my database stopped storing items

**Root cause:**

I had `"assets": { "directory": "." }` without a proper Worker entrypoint.

**Solution:**

You need both:

```jsonc
{
  "main": "../src/index.js", // ← Relative to wrangler.jsonc location!
  "assets": {
    "directory": ".",
    "binding": "ASSETS"
  }
}
```

Plus your regular bindings (D1, KV, etc.).

**Moral of the story:**

When combining static assets with dynamic logic (like a database), make sure you define a main script and properly bind the ASSETS. The dashboard can be misleading when things are partially configured.

Has anyone else hit this specific combo of issues? Especially after moving from dashboard-only to GitHub + Wrangler?

![Wrangler config diff screenshot](https://images.koorevaar.com/linkedin-import/cloudflare-worker-bindings-not-accepted.jpg)

---

*Co-authored with Claude.*

If this was useful, [you can buy me a coffee](https://ko-fi.com/p47k0).

New articles: [follow via RSS](https://blog.koorevaar.com/feed.xml).
