Arjun
Arjun
Explore posts from servers
HHono
Created by Arjun on 6/10/2024 in #help
Can someone explain why types aren't inferred
No description
11 replies
HHono
Created by Arjun on 6/4/2024 in #help
Module not found: Can't resolve 'path' with Hono Drizzle
The Error
./node_modules/dotenv/lib/main.js:2:1
Module not found: Can't resolve 'path'
./node_modules/dotenv/lib/main.js:2:1
Module not found: Can't resolve 'path'
The issue is somewhere either in this file
import { Hono } from "hono";

import { db } from "@/db/drizzle";
import { accounts } from "@/db/schema";

const app = new Hono().get("/", async (c) => {
console.log("running accounts query");


const data = async () => {
try {
const dbFetch = await db
.select({
id: accounts.id,
name: accounts.name,
})
.from(accounts);
return dbFetch;
} catch (error) {
console.log("Error fetching data from DB", error);
}
// when I comment out the data function and replace what's being passed to c.json() with something fixed then there is no issue but when I just try to run this function even when its not being passed to c.json() then it throws the same error

};

return c.json({ data });
});

export default app;
import { Hono } from "hono";

import { db } from "@/db/drizzle";
import { accounts } from "@/db/schema";

const app = new Hono().get("/", async (c) => {
console.log("running accounts query");


const data = async () => {
try {
const dbFetch = await db
.select({
id: accounts.id,
name: accounts.name,
})
.from(accounts);
return dbFetch;
} catch (error) {
console.log("Error fetching data from DB", error);
}
// when I comment out the data function and replace what's being passed to c.json() with something fixed then there is no issue but when I just try to run this function even when its not being passed to c.json() then it throws the same error

};

return c.json({ data });
});

export default app;
This file may help @/db/drizzle.ts
import "dotenv/config";

import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const connectionString = process.env.DATABASE_URL!;

// Disable prefetch as it is not supported for "Transaction" pool mode
export const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
import "dotenv/config";

import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const connectionString = process.env.DATABASE_URL!;

// Disable prefetch as it is not supported for "Transaction" pool mode
export const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
29 replies
DTDrizzle Team
Created by Arjun on 6/4/2024 in #help
Module not found error with Drizzle Nextjs Hono Supabase
The Error
./node_modules/dotenv/lib/main.js:2:1
Module not found: Can't resolve 'path'
./node_modules/dotenv/lib/main.js:2:1
Module not found: Can't resolve 'path'
The issue is somewhere either in this file
import { Hono } from "hono";

import { db } from "@/db/drizzle";
import { accounts } from "@/db/schema";

const app = new Hono().get("/", async (c) => {
console.log("running accounts query");


const data = async () => {
try {
const dbFetch = await db
.select({
id: accounts.id,
name: accounts.name,
})
.from(accounts);
return dbFetch;
} catch (error) {
console.log("Error fetching data from DB", error);
}
// when I comment out the data function and replace what's being passed to c.json() with something fixed then there is no issue but when I just try to run this function even when its not being passed to c.json() then it throws the same error

};

return c.json({ data });
});

export default app;
import { Hono } from "hono";

import { db } from "@/db/drizzle";
import { accounts } from "@/db/schema";

const app = new Hono().get("/", async (c) => {
console.log("running accounts query");


const data = async () => {
try {
const dbFetch = await db
.select({
id: accounts.id,
name: accounts.name,
})
.from(accounts);
return dbFetch;
} catch (error) {
console.log("Error fetching data from DB", error);
}
// when I comment out the data function and replace what's being passed to c.json() with something fixed then there is no issue but when I just try to run this function even when its not being passed to c.json() then it throws the same error

};

return c.json({ data });
});

export default app;
This file may help @/db/drizzle.ts
import "dotenv/config";

import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const connectionString = process.env.DATABASE_URL!;

// Disable prefetch as it is not supported for "Transaction" pool mode
export const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
import "dotenv/config";

import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const connectionString = process.env.DATABASE_URL!;

// Disable prefetch as it is not supported for "Transaction" pool mode
export const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
3 replies
DTDrizzle Team
Created by Arjun on 6/3/2024 in #help
no tables popping up in drizzle studio with supabase
No description
2 replies
TTCTheo's Typesafe Cult
Created by Arjun on 5/4/2023 in #questions
How do I solve this error
6 replies