Error: Failed to publish your Function. Got error: binding DB of type d1 failed to generate.

https://serverless-fullstack-alt-boilerplate.pages.dev/ daf6fec8-f507-4805-bef6-0eaca51c9858 95e4aff3a9a4f67ddf05efde2a8dabd9 Error when deploying, everything is working fine locally even on build preview and wrangler pages dev This is my toml
name = "boilerplate"
compatibility_date = "2024-11-11"
account_id = "95e4aff3a9a4f67ddf05efde2a8dabd9"
main = "./.svelte-kit/cloudflare/worker.js"
[[d1_databases]]
binding = "DB"
database_name = "boilerplate"
database_id = "93bf1a9f-4476-4ca4-a2bc-bf21f1c5df93"
name = "boilerplate"
compatibility_date = "2024-11-11"
account_id = "95e4aff3a9a4f67ddf05efde2a8dabd9"
main = "./.svelte-kit/cloudflare/worker.js"
[[d1_databases]]
binding = "DB"
database_name = "boilerplate"
database_id = "93bf1a9f-4476-4ca4-a2bc-bf21f1c5df93"
svelte config
import adapter from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
routes: {
include: ['/*'],
exclude: ['<all>']
},
platformProxy: {
configPath: 'wrangler.toml'
}
})
}
};
export default config;
import adapter from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
routes: {
include: ['/*'],
exclude: ['<all>']
},
platformProxy: {
configPath: 'wrangler.toml'
}
})
}
};
export default config;
app.d.ts
import type { DrizzleD1Database } from 'drizzle-orm/d1';
declare global {
namespace App {
interface Platform {
env: {
DB: DrizzleD1Database;
};
}
interface Locals {
database: DrizzleD1Database;
}
}
}
import type { DrizzleD1Database } from 'drizzle-orm/d1';
declare global {
namespace App {
interface Platform {
env: {
DB: DrizzleD1Database;
};
}
interface Locals {
database: DrizzleD1Database;
}
}
}
I'm still learning how the database and migrations works, I think im missing something.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?