Deploying Pages with D1 Binding via Wrangler.toml and GH Action
I've got a SvelteKit application deployed to Pages+Functions using the
I'm now trying to add a D1 database. I've added the binding to my
), but even after deploying the schema to the remote DB via the CLI, the D1 binding in the Function does not work on my branch deploy.
I suspect this is because the
The docs suggest configuring the binding via the dashboard but I'd like to keep it in my
The diff of the PR where I've made these changes is here: https://github.com/tylermercer/log-thing/pull/4/files/155fe21a260815b0607712ab0b51d0c627982a6d
My deployment: https://433388eb.log-thing.pages.dev/
The D1 test route showing the failed binding (which causes a 500): https://433388eb.log-thing.pages.dev/app/guestbook
Deployment ID:
Account ID:
@sveltekit/adapter-cloudflare adapter and the cloudflare/pages-action GitHub Actions action. I've confirmed that invoking API endpoints runs a Function as it should, both locally (via npm run dev) and on prod. I'm now trying to add a D1 database. I've added the binding to my
wrangler.toml file, and it works great locally (which is awesome I suspect this is because the
pages-action doesn't pick up the wrangler.toml, so I tried to switch to the wrangler-action, but I haven't figured out how to get it to deploy both the pages site and the D1 binding.The docs suggest configuring the binding via the dashboard but I'd like to keep it in my
wrangler.toml so I have one source of truth, if possible.The diff of the PR where I've made these changes is here: https://github.com/tylermercer/log-thing/pull/4/files/155fe21a260815b0607712ab0b51d0c627982a6d
My deployment: https://433388eb.log-thing.pages.dev/
The D1 test route showing the failed binding (which causes a 500): https://433388eb.log-thing.pages.dev/app/guestbook
Deployment ID:
433388eb-4769-41d9-9dbd-56583c4a2014Account ID:
191456bbc4d963669ab6dd59c256d84a