KWAC
Explore posts from serversDTDrizzle Team
•Created by KWAC on 7/31/2024 in #help
quering with nuxt + drizzle + cloudflare D1
I'm using nuxt + drizzle orm + cloudflare D1.
my schema.ts looks like this
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"
export const user = sqliteTable('users', {
id: text("id").primaryKey(),
firstname: text("first_name").notNull(),
lastname: text("last_name").notNull(),
email: text("email").unique().notNull(),
username: text("username").unique().notNull(),
password: text("password").notNull(),
confirm_password: text("confirm_password").notNull(),
country: text("country").notNull(),
gender: text("gender").notNull(),
date_of_birth: text("date_of_birth").notNull(),
selectedPhoneCode: text("selectedPhoneCode").notNull(),
phone: text("phone").notNull(),
created_at: integer('created_at', { mode: 'timestamp' }).notNull()
})
export const session = sqliteTable("session", {
id: text("id").primaryKey(),
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
userId: text("user_id")
.notNull()
.references(() => user.id, { onDelete: "cascade" }),
})
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"
export const user = sqliteTable('users', {
id: text("id").primaryKey(),
firstname: text("first_name").notNull(),
lastname: text("last_name").notNull(),
email: text("email").unique().notNull(),
username: text("username").unique().notNull(),
password: text("password").notNull(),
confirm_password: text("confirm_password").notNull(),
country: text("country").notNull(),
gender: text("gender").notNull(),
date_of_birth: text("date_of_birth").notNull(),
selectedPhoneCode: text("selectedPhoneCode").notNull(),
phone: text("phone").notNull(),
created_at: integer('created_at', { mode: 'timestamp' }).notNull()
})
export const session = sqliteTable("session", {
id: text("id").primaryKey(),
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
userId: text("user_id")
.notNull()
.references(() => user.id, { onDelete: "cascade" }),
})
3 replies
CDCloudflare Developers
•Created by KWAC on 7/30/2024 in #workers-help
Error after running command - npx wrangler pages deploy dist/ error happens
:sparkles: Compiled Worker successfully
Your worker has access to the following bindings:
- D1 Databases:
- DB: test (e501084c-f3f4-423e-a47d-8d829c92bfe7)
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
C:\Users\Admin\Desktop\taskerdata\node_modules\wrangler\wrangler-dist\cli.js:29765
throw a;
^
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (C:\Users\Admin\Desktop\test\node_modules\miniflare\dist\src\index.js:9178:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async #setOptions (C:\Users\Admin\Desktop\test\node_modules\miniflare\dist\src\index.js:9301:5)
at async Mutex.runWith (C:\Users\Admin\Desktop\test\node_modules\miniflare\dist\src\index.js:3521:16) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
Node.js v20.9.0
:sparkles: Compiled Worker successfully
Your worker has access to the following bindings:
- D1 Databases:
- DB: test (e501084c-f3f4-423e-a47d-8d829c92bfe7)
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
C:\Users\Admin\Desktop\taskerdata\node_modules\wrangler\wrangler-dist\cli.js:29765
throw a;
^
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (C:\Users\Admin\Desktop\test\node_modules\miniflare\dist\src\index.js:9178:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async #setOptions (C:\Users\Admin\Desktop\test\node_modules\miniflare\dist\src\index.js:9301:5)
at async Mutex.runWith (C:\Users\Admin\Desktop\test\node_modules\miniflare\dist\src\index.js:3521:16) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
Node.js v20.9.0
3 replies
nuxt 3 + cloudfare D1 problems with env.d.ts file
I'm using nuxt 3 with cloudfare D1, but I have encountered some problems.
It seems that it cannot read env.d.ts file I have created. I'm getting this error:
I used this repo: https://github.com/tlebeitsuk/nuxt-cloudflare-lucia
My configured env.d.ts file:
500 Cannot read properties of undefined (reading 'env')
500 Cannot read properties of undefined (reading 'env')
import { CfProperties, Request, ExecutionContext, KVNamespace, D1Database } from '@cloudflare/workers-types';
declare module 'h3' {
interface H3EventContext {
cf: CfProperties,
cloudflare: {
request: Request,
env: {
MY_KV: KVNamespace,
DB: D1Database,
}
context: ExecutionContext,
};
}
}
import { CfProperties, Request, ExecutionContext, KVNamespace, D1Database } from '@cloudflare/workers-types';
declare module 'h3' {
interface H3EventContext {
cf: CfProperties,
cloudflare: {
request: Request,
env: {
MY_KV: KVNamespace,
DB: D1Database,
}
context: ExecutionContext,
};
}
}
22 replies