`compatibility_flags = ["nodejs_compat"]` and `node_compat = true` not having the same compatability
compatibility_flags = ["nodejs_compat"] and node_compat = true not having the same compatabilitycompatibility_flags = ["nodejs_compat"]node_compat = truenode_compat polyfill system, which isn't supported on Functions.wranglersamlify and it is importing some exports from node-forge but those are undefined. I get TypeError: Cannot read properties of undefined (reading 'decode64') at .... It works fine locally but I'm not sure how to debug what is going on when it's deployed to CloudFlare. Does anyone have any ideas?/api
npm i @cf-wasm/satori. There is 1 other project in the npm registry using @cf-wasm/satori.
npm i @cf-wasm/og. There are no other projects in the npm registry using @cf-wasm/og.
wrangler.toml and running a wrangler pages dev command results in a hanging browser. Raised it on GitHub (https://github.com/cloudflare/workers-sdk/issues/6173), then noticed the message on https://developers.cloudflare.com/pages/functions/wrangler-configuration/ that said to come here... does anyone know if this is expected behaviour or am I doing something wrong?
index.html in a directory, then run wrangler pages dev <directory>?node_compat.wranglersamlifynode-forgeTypeError: Cannot read properties of undefined (reading 'decode64') at ..../apinpm i @cf-wasm/satorinpm i @cf-wasm/ogimport { satori } from "@cf-wasm/satori"; // <- for cf workers/pages
import { satori } from "@cf-wasm/satori/next"; // <- for next js edgewrangler.tomlwrangler pages devwrangler pages dev <directory>export default {
async fetch(request, env) {
const url = new URL(request.url);
if (url.pathname.startsWith('/api/')) {
const apiRequest = new Request(
`https://your-worker-url.com${url.pathname}`,
request
);
return env.MY_WORKER_SERVICE.fetch(apiRequest);
}
return env.ASSETS.fetch(request);
},
};
});// functions/api/[[route]].ts
export const onRequest: PagesFunction = ({ request }) => {
const url = new URL(request.url);
url.host = "your-worker-url.com";
return fetch(url.toString(), request);
};