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 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 btwexport 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: .envimport consumers from 'stream/consumers'BufferStreamsnode_compat = truenode_compat = truecompatibility_flags = [ "nodejs_compat" ]import consumers from 'node:stream/consumers'✘ [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.