thanhle
thanhle
CDCloudflare Developers
Created by Hữu Phong on 4/19/2024 in #pages-help
Unable to deploy Next.js 14.2
i bet the issue is bun. i used npm.
8 replies
CDCloudflare Developers
Created by Hữu Phong on 4/19/2024 in #pages-help
Unable to deploy Next.js 14.2
seem like 14.2 has a lot of issues. i am still working with 14.1 and it works great. sometime we dont need the newest version of next to be successful
8 replies
CDCloudflare Developers
Created by Hữu Phong on 4/19/2024 in #pages-help
Unable to deploy Next.js 14.2
do you try with 14.1
8 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
i try to use Client instead of Pool but Client did not work in my case. dont know the issue?
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
this works for me: just change with your databaseurl and see: import pkg from "pg"; const { Pool } = pkg; export default { async fetch(request, env, ctx) { const connectionString = "postgresql://xxxxxxxxx:xxxxxxxxxxx@xxxxxxxxxxxxx:xxxxxxxxxx/xxxxxxxxxxxxxx?ssl=true"; let pool = null; try { pool = new Pool({ connectionString }); const result = await pool.query('SELECT * FROM "Message"'); return new Response(JSON.stringify(result.rows), { headers: { "Content-Type": "application/json" }, }); } catch (error) { console.error("Database connection error:", error); return new Response(JSON.stringify({ error: error.message }), { headers: { "Content-Type": "application/json" }, status: 500, }); } finally { if (pool) { try { await pool.end(); } catch (err) { console.error("Failed to close database connection:", err); } } } }, };
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
dont worry I will try and let you know immediately. i will test with my database url (that I knew it should work)
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
small git is ok
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
can you make a reprocude with github
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
How do you deploy your worker? By wrangler?
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
can you share your package,json
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
I think the issue in your code is "node_compat = true", just use compatibility_flags = [ "nodejs_compat" ] instead.
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
wrangler:toml : name = "my-app" compatibility_date = "2024-03-29" main = "src/index.mjs" minify = true compatibility_flags = [ "nodejs_compat" ]
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
my packgae.json: "pg": "^8.11.3", "hono": "^4.1.3",
19 replies
CDCloudflare Developers
Created by barrettshepherd on 4/17/2024 in #workers-help
Postgresql Connection (Node) erroring: No such module "cloudflare:sockets".
here is my setup work with CF Worker: import { Hono } from "hono"; import pkg from "pg"; const app = new Hono(); const { Pool } = pkg; const connectionString = "xxxxxxxxxxxxxxxxxxxxxxxx"; app.post("/users", async (c) => { const { email, id, name } = await c.req.json(); const pool = new Pool({ connectionString }); try { const res = await pool.query( INSERT INTO "User" (id, email, name) VALUES ($1, $2, $3), [id, email, name] ); return c.json(res.rows); } catch (err) { console.error("Error executing query:", err); return c.text("Errors!!!!!!"); } finally { await pool.end(); } }); export default app;
19 replies
CDCloudflare Developers
Created by Jacob Marshall on 4/13/2024 in #pages-help
Deploying with wrangler.toml with a Service Binding stuck in Queued state
i am glad this helps
15 replies
CDCloudflare Developers
Created by luv on 4/15/2024 in #pages-help
Can you deploy a Next.JS to CloudFlare Pages thats using both SSR and static SSG?
Yes it is way more cheaper than other service. And DX is great
36 replies
CDCloudflare Developers
Created by luv on 4/15/2024 in #pages-help
Can you deploy a Next.JS to CloudFlare Pages thats using both SSR and static SSG?
Dont add the export const runtime = edge to that route, then is is static generated at build time.
36 replies
CDCloudflare Developers
Created by Jacob Marshall on 4/13/2024 in #pages-help
Deploying with wrangler.toml with a Service Binding stuck in Queued state
can you try to add environment="production"
15 replies
CDCloudflare Developers
Created by Jacob Marshall on 4/13/2024 in #pages-help
Deploying with wrangler.toml with a Service Binding stuck in Queued state
No description
15 replies