Does anyone have a working example of D1 + next-on-pages for both local dev and production?
Does anyone have a working example of D1 + next-on-pages for both local dev and production?
workers.api.error.script_too_largeError: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workers/runtime-apis/handlers/
Full stack trace varies depending on when the error occurred, but it typically involves files in the .vercel/output/static/_worker.js directory.src/pages/api/signup.js api route that uses fetch to do a POST request to another app. When deploying it, the build failed and I needed to add the export const config = { runtime: 'experimental-edge' }; export to the api functionreq, res which are the parameters passed into the handler function don't work. The fetch API doesn't respect the method parameter I set and is still just doing a GET request.export const runtime = 'edge'
"pages:build": "npx @cloudflare/next-on-pages"


export default { async queue(....) { .... } } ?process.env.TURSO_DATABASE_URL is undefiend during the build. It successes when I tried to set [env.production.vars] in wrangler.toml.wrangler.toml?process.env.TURSO_DATABASE_URL is still undefined[env.production.vars] of wrangler.tomlinvalid prerender config error on pages using export const dynamicParams = off workers.api.error.script_too_largeError: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workers/runtime-apis/handlers/
Full stack trace varies depending on when the error occurred, but it typically involves files in the .vercel/output/static/_worker.js directory.src/pages/api/signup.jsexport const config = { runtime: 'experimental-edge' };req, reshandlermethodGETexport const runtime = 'edge'"pages:build": "npx @cloudflare/next-on-pages"export default { async queue(....) { .... } }// prisma.ts
import { PrismaClient } from "@prisma/client";
import { PrismaLibSQL } from "@prisma/adapter-libsql";
import { createClient } from "@libsql/client";
let prisma: PrismaClient;
const libsql = createClient({
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
});
export const prisma = new PrismaClient({ adapter });LibsqlError: URL_INVALID: The URL 'undefined' is not in a valid formatprocess.env.TURSO_DATABASE_URLprocess.env.TURSO_DATABASE_URLundefiend[env.production.vars][env.production.vars]wrangler.tomlwrangler.tomlundefinedinvalid prerender configexport const dynamicParams = off