From Neon database to supabase (using Drizzle ORM)
Hi everyone,
I'm migrating a Next.js application (
Steps Taken:
const client = postgres(connectionString, {max: 1})
const db = drizzle(client, {schema});
export default db;
⨯ cloudflare:sockets
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
Import trace for requested module:
cloudflare:sockets
./node_modules/postgres/cf/polyfills.js
./node_modules/postgres/cf/src/index.js
./db/drizzle.ts
./lib/auth.ts
js
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { webpack }) => {
config.plugins.push(new webpack.IgnorePlugin({
resourceRegExp: /^pg-native$|^cloudflare:sockets$/,
}));
return config;
},
// ... other Next.js configuration
};
export default nextConfig;
```
I'm migrating a Next.js application (
v14.1.3) using Drizzle ORM (v^0.30.2) from Neon Database to Supabase.Steps Taken:
- Updated the database URL in my .env file.
- Modified
db/drizzle.tsto use Supabase with the following code:
```typescript
import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from "./schema"
const client = postgres(connectionString, {max: 1})
const db = drizzle(client, {schema});
export default db;
⨯ cloudflare:sockets
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
Import trace for requested module:
cloudflare:sockets
./node_modules/postgres/cf/polyfills.js
./node_modules/postgres/cf/src/index.js
./db/drizzle.ts
./lib/auth.ts
js
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { webpack }) => {
config.plugins.push(new webpack.IgnorePlugin({
resourceRegExp: /^pg-native$|^cloudflare:sockets$/,
}));
return config;
},
// ... other Next.js configuration
};
export default nextConfig;
```