$0
$0
CDCloudflare Developers
Created by $0 on 10/19/2024 in #pages-help
[ERROR] A request to the Cloudflare API failed.
:craig: 😭
7 replies
CDCloudflare Developers
Created by $0 on 10/19/2024 in #pages-help
[ERROR] A request to the Cloudflare API failed.
Is the limit the total size, not one file? My site is too big. Is there a way to raise the limit?
7 replies
CDCloudflare Developers
Created by $0 on 7/28/2024 in #pages-help
the script will never generate a response.
Do you mean that you had to call new PrismaClient({ adapter }) for each request ? >Yes.
13 replies
CDCloudflare Developers
Created by $0 on 8/5/2024 in #hyperdrive
Hyperdrive: making databases feel like t...
I'm looking forward to hyperdrive mysql(TiDB) support.
10 replies
CDCloudflare Developers
Created by $0 on 8/5/2024 in #hyperdrive
Hyperdrive: making databases feel like t...
Yes. It's for a new hobby project. https://subnect.com alloyDB seems to be fast, so I wanted to experience the speed. I'm currently using TiDB.
10 replies
CDCloudflare Developers
Created by $0 on 8/5/2024 in #hyperdrive
Hyperdrive: making databases feel like t...
I will give up because the intermediate VM settings are complicated and the cost will be even more expensive. Thank you for your answer.
10 replies
CDCloudflare Developers
Created by $0 on 8/5/2024 in #hyperdrive
Hyperdrive: making databases feel like t...
No description
10 replies
CDCloudflare Developers
Created by $0 on 8/5/2024 in #hyperdrive
Hyperdrive: making databases feel like t...
The cloudflare blog mentioned above states the following:
Hyperdrive works not only with PostgreSQL databases — including Neon, Google Cloud SQL, AWS RDS, and Timescale, but also PostgreSQL-compatible databases like Materialize (a powerful stream-processing database), CockroachDB (a major distributed database), Google Cloud’s AlloyDB, and AWS Aurora Postgres.
Hyperdrive works not only with PostgreSQL databases — including Neon, Google Cloud SQL, AWS RDS, and Timescale, but also PostgreSQL-compatible databases like Materialize (a powerful stream-processing database), CockroachDB (a major distributed database), Google Cloud’s AlloyDB, and AWS Aurora Postgres.
The documentation does not include instructions on how to connect to AlloyDB, so I am trying the same method as Google Cloud SQL. https://developers.cloudflare.com/hyperdrive/examples/google-cloud-sql/
10 replies
CDCloudflare Developers
Created by $0 on 8/2/2024 in #pages-help
Unexpected end of JSON ( How to use Durable Objects with next-on-pages? )
I tried binding the DurableObject directly, but I still get the same error.
export const runtime = "edge";

import { NextRequest } from "next/server";
import { getRequestContext } from "@cloudflare/next-on-pages";
import { getPrismaClient }from "@/lib/db";
import checkAuth from "@/utils/checkAuth";

export async function GET(req: NextRequest): Promise<Response> {
try {
const prisma = getPrismaClient();
const { profileId } = await checkAuth(prisma) || {};
if (!profileId) {
console.log("User not authenticated.");
return new Response("User not authenticated.", { status: 401 });
};

const id = getRequestContext().env.WEBSOCKET.idFromName(profileId.toString());
const roomObject = getRequestContext().env.WEBSOCKET.get(id);

console.log("aaa");
const response = await roomObject.fetch(`http://service-binding/websocket`, req);
console.log("bbb");
console.log(response.status);

return response
} catch (error) {
console.log("Internal server error.");
console.error(error);
return new Response("Internal server error.", { status: 500 });
};
};
export const runtime = "edge";

import { NextRequest } from "next/server";
import { getRequestContext } from "@cloudflare/next-on-pages";
import { getPrismaClient }from "@/lib/db";
import checkAuth from "@/utils/checkAuth";

export async function GET(req: NextRequest): Promise<Response> {
try {
const prisma = getPrismaClient();
const { profileId } = await checkAuth(prisma) || {};
if (!profileId) {
console.log("User not authenticated.");
return new Response("User not authenticated.", { status: 401 });
};

const id = getRequestContext().env.WEBSOCKET.idFromName(profileId.toString());
const roomObject = getRequestContext().env.WEBSOCKET.get(id);

console.log("aaa");
const response = await roomObject.fetch(`http://service-binding/websocket`, req);
console.log("bbb");
console.log(response.status);

return response
} catch (error) {
console.log("Internal server error.");
console.error(error);
return new Response("Internal server error.", { status: 500 });
};
};
aaa bbb 101 [wrangler:err] SyntaxError: Unexpected end of JSON input [wrangler:err] TypeError: Web Socket request did not return status 101 Switching Protocols response with Web Socket [wrangler:inf] GET /api/users/profiles/websocket 500 Internal Server Error (68ms)
5 replies
CDCloudflare Developers
Created by $0 on 8/2/2024 in #pages-help
Unexpected end of JSON ( How to use Durable Objects with next-on-pages? )
src/app/api/users/profiles/websocket
export const runtime = "edge";

import { NextRequest } from "next/server";
import { getRequestContext } from "@cloudflare/next-on-pages";
import { getPrismaClient }from "@/lib/db";
import checkAuth from "@/utils/checkAuth";

export async function GET(req: NextRequest): Promise<Response> {
try {
const prisma = getPrismaClient();
const { profileId } = await checkAuth(prisma) || {};
if (!profileId) {
console.log("User not authenticated.");
return new Response("User not authenticated.", { status: 401 });
};

const url = new URL(req.url);
url.pathname = `/${profileId}/websocket`;
const request = new Request(url, req.clone());

const workerResponse = await getRequestContext().env.WEBSOCKET.fetch(request);

console.log("Worker response status:", workerResponse.status);
console.log("Worker response headers:", Object.fromEntries(workerResponse.headers));

return workerResponse;
} catch (error) {
console.log("Internal server error.");
console.error(error);
return new Response("Internal server error.", { status: 500 });
};
};
export const runtime = "edge";

import { NextRequest } from "next/server";
import { getRequestContext } from "@cloudflare/next-on-pages";
import { getPrismaClient }from "@/lib/db";
import checkAuth from "@/utils/checkAuth";

export async function GET(req: NextRequest): Promise<Response> {
try {
const prisma = getPrismaClient();
const { profileId } = await checkAuth(prisma) || {};
if (!profileId) {
console.log("User not authenticated.");
return new Response("User not authenticated.", { status: 401 });
};

const url = new URL(req.url);
url.pathname = `/${profileId}/websocket`;
const request = new Request(url, req.clone());

const workerResponse = await getRequestContext().env.WEBSOCKET.fetch(request);

console.log("Worker response status:", workerResponse.status);
console.log("Worker response headers:", Object.fromEntries(workerResponse.headers));

return workerResponse;
} catch (error) {
console.log("Internal server error.");
console.error(error);
return new Response("Internal server error.", { status: 500 });
};
};
5 replies
CDCloudflare Developers
Created by $0 on 8/2/2024 in #pages-help
Unexpected end of JSON ( How to use Durable Objects with next-on-pages? )
src/index.mjs
5 replies
CDCloudflare Developers
Created by $0 on 7/28/2024 in #pages-help
the script will never generate a response.
Thanks to you, I understood the cause. It was necessary to connect the DB for each request.
13 replies
CDCloudflare Developers
Created by $0 on 7/28/2024 in #pages-help
the script will never generate a response.
I'm not good at English, but translate and read this site, you can expect that the reason why the image is not displayed is to access the image at the same time with multiple img tags.
13 replies
CDCloudflare Developers
Created by $0 on 7/28/2024 in #pages-help
the script will never generate a response.
13 replies