Vercel Postgres failed to work locally
I tried to use vercel postgres but getting the following error. It is working on the vercel deployment tho.
[0] ⨯ 262 | // if (!newSet.has(issue)) {
[0] 263 | // console.error(
✅ ${displayName} fixed ${issue})
[0] 264 | // }
[0] 265 | // }
[0] 266 | if (relevantIssues.size && throwIssue) {
[0] 267 | throw new ModuleBuildError([
[0] ^
[0] error: error - node_modules/node-gyp-build/node-gyp-build.js:22:9
[0]
[0] 20 |
[0] 21 | function load (dir) {
[0] > 22 | return runtimeRequire(load.resolve(dir))
[0] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[0] 23 | }
[0] 24 |
[0] 25 | load.resolve = load.path = function (dir) {
[0] Module not found
[0] It was not possible to find the requested file.
[0] Parsed request as written in source code: dynamic
[0] Path where resolving has started: [project]/node_modules/node-gyp-build/node-gyp-build.js
[0] Type of request: commonjs request
[0] Import map: No import map entry
This is my drizzle.config.ts:
import "@/db/envConfig";
import { defineConfig } from "drizzle-kit";
export default defineConfig({
schema: "./src/db/schema.ts",
out: "./migrations",
dialect: "postgresql",
dbCredentials: {
url: process.env.POSTGRES_URL!,
ssl: {
rejectUnauthorized: false,
},
},
});
This is the index.ts
import "./envConfig";
import { drizzle } from "drizzle-orm/vercel-postgres";
import * as schema from "./schema";
import { sql } from "@vercel/postgres";
export const db = drizzle(sql, { schema });
0 Replies