hey! I'm getting this error when using Drizzle orm. Is this fixed? any workarounds for this?
hey! I'm getting this error when using Drizzle orm. Is this fixed? any workarounds for this?
return NextResponse.redirect(new URL("/auth", request.url));router.push instead of router.refresh on auth success e.g
Unexpected error: ENOENT: no such file or directory, copyfile '/opt/buildhome/repo/.vercel/output/functions/blog/[slug].func/wasm/wasm_ef4866ecae192fd87727067cf2c0c0cf9fb8b020.wasm' -> '/opt/buildhome/repo/.vercel/output/static/_worker.js/__next-on-pages-dist__/wasm/wasm_ef4866ecae192fd87727067cf2c0c0cf9fb8b020.wasm' is the culprit but I don't know anything about what could cause it
compatibility_flags = ["nodejs_compat"] in wrangler.toml but on publish, the deployed result says it must be enabled from dashgetRequestContext from a next handler for local dev
getRequestContext utility in the edge runtime?process.env and it worked actuallyprocess.env works getRequestContext should work as well export const runtime = "edge";process.env worked without it somehowreturn NextResponse.redirect(new URL("/auth", request.url));router.pushrouter.refresh19:01:36.442 ▲ Build Completed in .vercel/output [57s]
19:01:36.553 ⚡️ Completed `npx vercel build`.
19:01:39.216 ⚡️ Unexpected error: ENOENT: no such file or directory, copyfile '/opt/buildhome/repo/.vercel/output/functions/blog/[slug].func/wasm/wasm_ef4866ecae192fd87727067cf2c0c0cf9fb8b020.wasm' -> '/opt/buildhome/repo/.vercel/output/static/_worker.js/__next-on-pages-dist__/wasm/wasm_ef4866ecae192fd87727067cf2c0c0cf9fb8b020.wasm'
19:01:39.272 Finished
19:01:39.273 Found _worker.js in output directory. Uploading.
19:01:40.514 Attaching additional modules:
19:01:40.515 - __next-on-pages-dist__/manifest/27d10e462fba646daaa29468a0656e12.js (esm)
19:01:40.515 - __next-on-pages-dist__/manifest/__RSC_SERVER_MANIFEST.js (esm)
19:01:40.515 - __next-on-pages-dist__/webpack/137.js (esm)
19:01:40.515 - __next-on-pages-dist__/webpack/1796.js (esm)
19:01:40.516 - __next-on-pages-dist__/webpack/44bff480f105853cb03b9b061f5738d6.js (esm)
19:01:40.516 - __next-on-pages-dist__/webpack/5303.js (esm)
19:01:40.516 - __next-on-pages-dist__/webpack/6595.js (esm)
19:01:40.516 - __next-on-pages-dist__/webpack/8775.js (esm)
19:01:40.516 - __next-on-pages-dist__/webpack/8f135fd1cad616b24af4b973584a7795.js (esm)
19:01:40.677 ✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.
19:01:40.678
19:01:40.678
19:01:40.682
19:01:40.683 ✘ [ERROR] Could not resolve "/opt/buildhome/repo/.vercel/output/static/_worker.js/index.js"
19:01:40.683
19:01:40.683
19:01:40.685 ✘ [ERROR] Build failed with 1 error:
19:01:40.685
19:01:40.685 error: Could not resolve "/opt/buildhome/repo/.vercel/output/static/_worker.js/index.js"
19:01:40.685
19:01:40.685
19:01:40.698 Failed building Pages Functions.
19:01:41.641 Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrHUnexpected error: ENOENT: no such file or directory, copyfile '/opt/buildhome/repo/.vercel/output/functions/blog/[slug].func/wasm/wasm_ef4866ecae192fd87727067cf2c0c0cf9fb8b020.wasm' -> '/opt/buildhome/repo/.vercel/output/static/_worker.js/__next-on-pages-dist__/wasm/wasm_ef4866ecae192fd87727067cf2c0c0cf9fb8b020.wasm'export async function GET(request: NextRequest) {
const db = drizzle(process.env.DB);
console.log("DB", db)
const customers = await db.select().from(users).all()
return new Response(JSON.stringify(customers), {
headers: { "Content-Type": "application/json" },
});
}compatibility_flags = ["nodejs_compat"]getRequestContextgetRequestContextgetRequestContextprocess.envprocess.envprocess.envexport const runtime = "edge";// file: env.d.ts
interface CloudflareEnv {
KV: KVNamespace;
}import { KVNamespace } from "@cloudflare/workers-types";
declare global {
interface CloudflareEnv {
KV: KVNamespace;
}
}import { ImageResponse } from 'next/og'
import Image from 'next/image'
// Route segment config
export const runtime = 'edge'
// Image metadata
export const size = {
width: 32,
height: 32,
}
export const contentType = 'image/png'
// Image generation
export default function Icon() {
return new ImageResponse(
(
// ImageResponse JSX element
<Image height={size.height} width={size.width} src="/favicons/apple-icon-180x180.png" alt="PurpleHosting - Icon" />
),
// ImageResponse options
{
// For convenience, we can re-use the exported icons size metadata
// config to also set the ImageResponse's width and height.
...size,
}
)
}import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev";
if (process.env.NODE_ENV === "development") {
await setupDevPlatform({});
}