cloudflare plugin #50177
Replies: 19 comments 50 replies
-
This is a known issue with
|
Beta Was this translation helpful? Give feedback.
-
Doing exactly the same thing as @kennyyang2015 (azimuttapp/azimutt#215) ^^ |
Beta Was this translation helpful? Give feedback.
-
I am getting the same error using import { Pool } from "@neondatabase/serverless"; const pool = new Pool({ connectionString }); anyone know a fix ? |
Beta Was this translation helpful? Give feedback.
-
I fixed that issue with the following webpack config:
|
Beta Was this translation helpful? Give feedback.
-
since this is an optional dependency that we don't use, we simply delete it via postinstall: {
"scripts": {
"postinstall": "shx rm -rf node_modules/pg-cloudflare"
}
} |
Beta Was this translation helpful? Give feedback.
-
In case anyone else comes across this thread. One option, at least in my case, is to recognize this happens when using the edge runtime with postgres, so not using edge fixed it for me |
Beta Was this translation helpful? Give feedback.
-
I ran into this as well, I have a working repo here with Next.js + Drizzle + Postgres + NextAuth: https://github.com/vercel/nextjs-postgres-auth-starter |
Beta Was this translation helpful? Give feedback.
-
I encountered as well with Next.js + Drizzle + Postgres + NextAuth. |
Beta Was this translation helpful? Give feedback.
-
i tried using neon and it worked nicely. Postgres is not compatible with edge runtime is the problem. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I just downgraded postgres version from 3.4.3 to 3.3 and it just works with DrizzleAdapter. Below are the package versions that I am using: "next": "14.1.0", |
Beta Was this translation helpful? Give feedback.
-
Currently non of these fixes are working for me. The latest suggestion, downgrading postgres to 3.4, also did not work. I will move away from middleware authentication for now. Hope to see an update on this issue at some point soon. |
Beta Was this translation helpful? Give feedback.
-
i forgot to remove these three line of code when i copy schema from auth.js : // const connectionString = "postgres://postgres:postgres@localhost:5432/drizzle"; // export const db = drizzle(pool); this is my mistake , check if you remove this lines from schema |
Beta Was this translation helpful? Give feedback.
-
Hello, we added support to be able to use the In your webpack: (config) => {
config.externals.push('cloudflare:sockets');
config.externalsType = 'commonjs';
}) |
Beta Was this translation helpful? Give feedback.
-
Had same issue with next, next-auth , drizzle and postgres (local docker) setup. All latest version of dependencies and postgres": "3.3" worked for me. Webpack fix didn't worked . "drizzle-orm": "^0.29.5", |
Beta Was this translation helpful? Give feedback.
-
I encounter this error too with lucia auth Here is my middleware file import {
DEFAULT_LOGIN_REDIRECT,
PUBLIC_ROUTES,
AUTH_ROUTES,
API_AUTH_PREFIX,
LOGIN_REDIRECT,
} from "@/routes";
import { NextRequest } from "next/server";
import { validateRequest } from "@/lib/lucia";
export async function middleware(req: NextRequest) {
const { user } = await validateRequest();
const isLogin = true;
const { nextUrl } = req;
const isApiAuthRoute = nextUrl.pathname.startsWith(API_AUTH_PREFIX);
const isAuthRoute = AUTH_ROUTES.includes(req.nextUrl.pathname);
const isPublicRoute = PUBLIC_ROUTES.includes(req.nextUrl.pathname);
if (isApiAuthRoute) {
return;
}
if (isAuthRoute) {
if (isLogin) {
return Response.redirect(new URL(DEFAULT_LOGIN_REDIRECT, nextUrl));
}
return;
}
if (!isLogin && !isPublicRoute) {
return Response.redirect(new URL(LOGIN_REDIRECT, nextUrl));
}
return;
}
export default middleware;
export const config = {
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
}; Here is my validate validateRequest() export const validateRequest = cache(
async (): Promise<
{ user: User; session: Session } | { user: null; session: null }
> => {
const sessionId = cookies().get(lucia.sessionCookieName)?.value ?? null;
if (!sessionId) {
return {
user: null,
session: null,
};
}
const result = await lucia.validateSession(sessionId);
// next.js throws when you attempt to set cookie when rendering page
try {
if (result.session && result.session.fresh) {
const sessionCookie = lucia.createSessionCookie(result.session.id);
cookies().set(
sessionCookie.name,
sessionCookie.value,
sessionCookie.attributes
);
}
if (!result.session) {
const sessionCookie = lucia.createBlankSessionCookie();
cookies().set(
sessionCookie.name,
sessionCookie.value,
sessionCookie.attributes
);
}
} catch {}
return result;
}
); Whenever I use this
|
Beta Was this translation helpful? Give feedback.
-
If anyone is still having this issue, you might have |
Beta Was this translation helpful? Give feedback.
-
If anyone is facing this issue with Supabase, try using import { Pool } from '@neondatabase/serverless'
import { drizzle } from 'drizzle-orm/neon-serverless'
const connectionString = process.env.DATABASE_URL!
const pool = new Pool({ connectionString })
export const db = drizzle(pool) |
Beta Was this translation helpful? Give feedback.
-
Summary
Hi, I am a new developer trying to create a tool to visualize sql data tables, and to render and visualize the tables, I need a PostgreSQL URI so that i can connect to that database, but i am recieving this Error
" 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 "
have you guys ever received an error like this before and if so how did you solve it??
thanks in advance !
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions