setPreviewData 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 shouldimport consumers from 'stream/consumers', miniflare complains:Buffer and Streams API are supported, and I have set node_compat = true in my wrangler.toml. compatibility_flags = [ "nodejs_compat" ] in addition to node_compat = true?import consumers from 'node:stream/consumers' instead btwwrangler.toml config files, how does one enable logpush for Pages?wrangler.toml file with logpush = true or to configure...export 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-outimport { 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;$ next dev
created dev bindings
undefined
created dev bindings
undefined
▲ Next.js 14.1.0
- Local: http://localhost:3000
- Environments: .env✘ [ERROR] Could not resolve "stream/consumers"
src/routes/headlines.ts:13:22:
13 │ import consumers from 'stream/consumers'
╵ ~~~~~~~~~~~~~~~~~~
The package "stream/consumers" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.const Customers: FunctionComponent = async () => {
const response = await getRequest("CUSTOMERS");
const customers: Customer[] = await response.json();
return <CustomerPage customers={customers} />;
};
export async function createCustomer(customer: z.infer<typeof customerSchema>) {
try {
// Send request to KV to create customer
const id = uuidv4();
// Cleanup data by removing empty objects or arrays or strings
customer = removeEmptyData(customer);
// add id to object
customer.id = id;
await putRequest("CUSTOMERS", "id:" + id, customer);
// Return success message
return {
message: "Customer created",
description: `"${customer.firstName} ${customer.name}" has been created successfully`,
success: true,
data: customer,
};
} catch (error) {
return {
message: "Error creating customer",
description: `"${customer.firstName} ${customer.name}" could not be created`,
success: false,
};
} finally {
// Revalidate cache
revalidatePath("/customers");
}
}