Sveltekit Cloudflare adapter Remote Binding Not Works
What versions & operating system are you using?
node : v24.11.1
npm : 11.6.2
sveltkit : "^2.48.4"
svelte : "^5.43.6"
wrangler : "^4.47.0"
@sveltejs/adapter-cloudflare : "^7.2.4"
Please provide a link to a minimal reproduction
https://gist.github.com/dev-itzarun/3186d9d4caa4b2a6db6bda7d5ffff759
Describe the Bug
Cloudflare remote Binding Not works in Sveltekit Cloudflare Adapter
why try to run using : npx wrangler dev
Please provide any relevant error logs
When try to run : " http://127.0.0.1:8787"
Got this :
X [ERROR] ❌ Error during D1 operation: Error: D1_ERROR: Failed to parse body as JSON, got: Error: internal error; reference = skkdqb40o25jmloafk8f93ra
at async Object.fetch
(file:///D:/sv-projects/test/node_modules/miniflare/src/workers/core/entry.worker.ts:440:19)
at D1DatabaseSessionAlwaysPrimary._send (cloudflare-internal:d1-api:181:19)
at async D1DatabaseSessionAlwaysPrimary._sendOrThrow (cloudflare-internal:d1-api:135:25)
... 7 lines matching cause stack trace ...
at async Object.fetch
(file:///D:/sv-projects/test/.svelte-kit/cloudflare/_worker.js:100:13) {
[cause]: Error: Failed to parse body as JSON, got: Error: internal error; reference =
skkdqb40o25jmloafk8f93ra
at async Object.fetch
(file:///D:/sv-projects/test/node_modules/miniflare/src/workers/core/entry.worker.ts:440:19)
at D1DatabaseSessionAlwaysPrimary._send (cloudflare-internal:d1-api:182:24)
at async D1DatabaseSessionAlwaysPrimary._sendOrThrow (cloudflare-internal:d1-api:135:25)
at null.<anonymous> (async cloudflare-internal:d1-api:361:41)
at async GET
(file:///D:/sv-projects/test/.svelte-kit/output/server/entries/endpoints/test/_server.js:12:25)
at async render_endpoint
(file:///D:/sv-projects/test/.svelte-kit/output/server/index.js:255:22)
at async resolve2
(file:///D:/sv-projects/test/.svelte-kit/output/server/index.js:3608:23)
at async Object.handle
(file:///D:/sv-projects/test/.svelte-kit/output/server/chunks/hooks.server.js:32:20)
at async fn
(file:///D:/sv-projects/test/.svelte-kit/output/server/index.js:3473:16)
at async internal_respond
(file:///D:/sv-projects/test/.svelte-kit/output/server/index.js:3455:22)
at async Object.fetch
(file:///D:/sv-projects/test/.svelte-kit/cloudflare/_worker.js:100:13)
}
[wrangler:info] GET /test 500 Internal Server Error (233ms)
Guys Need Support
Only "https://developers.cloudflare.com/workers/development-testing/#remote-bindings" Remote Binding Not works
Could you help us debug this by providing a link to a Github repository that is all set up with a Sveltekit app that demonstrates this behaviour? I tried recreating the problem from your gist but couldn't get SvelteKit to build the server-side code, as I don't know much about that framework.
I just created a new SvelteKit application using C3, then replaced the +page.svelte file with +server.ts.
I updated the Wrangler config file to point to a database that I had created in my Cloudflare dashboard and ensured that Wrangler was logged into my Cloudflare account.
When I did this I could run pnpm wrangler dev and it would connect to the remote D1 database.
My Wrangler config looks like this (wrangler.json):
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "calm-wood-71ad",
"main": ".svelte-kit/cloudflare/_worker.js",
"compatibility_date": "2025-11-17",
"compatibility_flags": [
"nodejs_als"
],
"build": {
"command": "npm run build"
},
"assets": {
"binding": "ASSETS",
"directory": ".svelte-kit/cloudflare"
},
"observability": {
"enabled": true
},
"workers_dev": false,
"preview_urls": false,
"d1_databases": [
{"binding": "MAIN",
"database_name": "pete-test",
"database_id": "ba415e99-0fac-4903-a834-62deb02e94bc",
"remote": true,}
]
}
My svelte.config.js looks like:
import adapter from "@sveltejs/adapter-cloudflare";
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
fallback: 'plaintext',
routes: {
include: ['/*'],
exclude: ['<all>']
},
config: 'wrangler.jsonc'
})
}
};
export default config;
@petebacondarwin Thanks For this ,Let me Try and Update
Any update @dev-itzarun ?