it's not building with the wrangler file for Pages/Functions
it's not building with the wrangler file for Pages/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>?In advanced mode, your Function will assume full control of all incoming HTTP requests to your domain. Your Function is required to make or forward requests to your project’s static assets. Failure to do so will result in broken or unwanted behavior. Your Function must be written in Module syntax.
_routes.json to exclude all paths except the ones I define explicitly (such as /api/*).Error: Failed to publish your Function. Got error: No such compatibility flag: experimental:nodejs_compat_v2dev session, then check if there are any other wrangler processes, and stop them?ps aux | grep wrangler revealed a handful of instances knocking round in the background... killed them all and problem solved! Thanks so much for your help!node-forgeTypeError: Cannot read properties of undefined (reading 'decode64') at ....npm 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 pages dev <directory>✘ [ERROR] Failed to register worker in local service registry TypeError: fetch failed
at fetch
(/Users/andy/=/quests/delete-me-pages/node_modules/.pnpm/wrangler@3.62.0/node_modules/wrangler/wrangler-dist/cli.js:17209:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async registerWorker
(/Users/andy/=/quests/delete-me-pages/node_modules/.pnpm/wrangler@3.62.0/node_modules/wrangler/wrangler-dist/cli.js:203827:12)
at async Object.announceAndOnReady [as onReady]
(/Users/andy/=/quests/delete-me-pages/node_modules/.pnpm/wrangler@3.62.0/node_modules/wrangler/wrangler-dist/cli.js:206237:7)
{
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout
(/Users/andy/=/quests/delete-me-pages/node_modules/.pnpm/wrangler@3.62.0/node_modules/wrangler/wrangler-dist/cli.js:6031:29)
at
/Users/andy/=/quests/delete-me-pages/node_modules/.pnpm/wrangler@3.62.0/node_modules/wrangler/wrangler-dist/cli.js:5987:51
at Immediate._onImmediate
(/Users/andy/=/quests/delete-me-pages/node_modules/.pnpm/wrangler@3.62.0/node_modules/wrangler/wrangler-dist/cli.js:6019:13)
at process.processImmediate (node:internal/timers:478:21)
at process.topLevelDomainCallback (node:domain:160:15)
at process.callbackTrampoline (node:internal/async_hooks:128:24) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
[wrangler:inf] GET / 200 OK (5989ms)/api/*Error: Failed to publish your Function. Got error: No such compatibility flag: experimental:nodejs_compat_v2ps aux | grep wranglerexport 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);
};{
"version": 1,
"include": ["/api/*"],
"exclude": ["/*"]
}