I'm not really able to share my code, are you using api and server actions?
I'm not really able to share my code, are you using api and server actions?
<form action={myServerAction} />export const runtime = 'edge' on both files and it still wouldn't runnpm run dev and Vercelnpm run pages:preview and CF pages prod breaks itsetPreviewData is not defined on the WebNextResponse when using experimental-edge runtimenext dev the bindings don't seem to exist which is weird as the docs say they should<form action={myServerAction} />npm run devnpm run pages:previewsetPreviewDataWebNextResponseexperimental-edgeres.status is not a functionexport const config = {
runtime: 'edge',
}
export default function handler(req, res) {
res.status(200).json({ message: 'Hello from Next.js!' })
}✨ Compiled Worker successfully
✨ Uploading Worker bundle
✨ Uploading _routes.json
✘ [ERROR] Received a malformed response from the API
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if I... (length = 6434)
POST /accounts/***/pages/projects/***/deployments -> 504 Gateway Time-outnext dev$ next dev
created dev bindings
undefined
created dev bindings
undefined
▲ Next.js 14.1.0
- Local: http://localhost:3000
- Environments: .envexport async function createTask(formData: FormData) {
const cookieStore = cookies();
const supabase = createClient(cookieStore);
const rawFormData = Object.fromEntries(formData.entries());
const newTaskData = {
title: rawFormData.title,
description: rawFormData.description,
completed: rawFormData.status === 'true',
due_date: rawFormData.due_date,
};
const { error } = await supabase.from('tasks').insert(newTaskData);
if (error) {
console.error('Error creating task:', error.message);
throw error;
}
redirect('/');
}import Link from 'next/link';
import { createTask } from '@/app/lib/actions';
export default async function Page() {
return (
<div className="flex justify-center w-full">
<div className="flex justify-center w-full px-2 sm:px-4 md:w-3/4">
<form action={createTask} className="w-full lg:w-3/4">
// form code
</form>
</div>
</div>
);
}import { setupDevBindings } from "@cloudflare/next-on-pages/next-dev";
/** @type {import('next').NextConfig} */
const nextConfig = {};
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
// (when running the application with `next dev`), for more information see:
// https://github.com/cloudflare/next-on-pages/blob/8e93067/internal-packages/next-dev/README.md
if (process.env.NODE_ENV === "development") {
console.log("created dev bindings");
await setupDevBindings({
bindings: {
DB: {
type: "d1",
databaseId: "alm-web-db",
},
},
});
console.log(process.env.DB);
}
export default nextConfig;