Still get the cancelled message... But we'll try that new suggestion...
Still get the cancelled message... But we'll try that new suggestion...
undocumented implementation detail. Like providing dummy properly formatted URI in fetch request to desired Service Binding. Nevertheless, @kian suggestion worked. 



pages dev functions and restarting on code changes.onRequest from a different folder, and I use the wrangler dev bundling. The details are here: wrangler pages dev when functions are not in root?export async function onRequestPost(context) { I am trying to POST some JSON to it. While logging context or context.request, or context.request.body I don't see the data I am passing in from a POST via curl or Postman. Request like text() & json(). So, if your request body is JSON, then you'd do...json() is basically JSON.parse(await request.text()), you'll get an object backYour worker created multiple branches of a single stream...GET are working fine, but nothing else even with "empty" APIs.ytdl-code but got errors everywhere :buffer)buffer then you might be able to use thatytdl-code to import from node:buffer instead and then use Workers NodeJS compat: https://developers.cloudflare.com/workers/runtime-apis/nodejs/node:buffer or finding an alternative package.node_compat = true to your wrangler.toml: https://developers.cloudflare.com/workers/wrangler/configuration/#node-compatibilitynode:buffer unfortunately.npx wrangler pages dev --compatibility-flags="nodejs_compat" -- npm run devnode_compat (the original one) works with Pages.node_compat vs nodejs_compat not the little js hehefunction generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
export async function onRequest(ctx) {
const response = Response.json({ response: { session: generateUUID() } });
response.headers.set('Access-Control-Allow-Origin', '*');
return response;
} 'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS',pages devonRequestexport async function onRequestPost(context) {contextcontext.requestcontext.requestcontext.request.bodybodyRequesttext()json()json()JSON.parse(await request.text())Your worker created multiple branches of a single stream...GETexport const onRequest: PagesFunction = async (context) => {
console.log('TRACKING');
return new Response();
};ytdl-codeytdl-code✘ [ERROR] 14 error(s) and 0 warning(s) when compiling Worker.
✘ [ERROR] Could not resolve "buffer"bufferbuffernode:buffernode:buffernode:buffernode_compat = truewrangler.tomlnpx wrangler pages dev --compatibility-flags="nodejs_compat" -- npm run devnode_compatnode_compatnodejs_compatjsexport async function onRequest(ctx) {
const response = Response.json({ response: { session: generateUUID() } });
response.headers.set("Access-Control-Allow-Origin", "*")
response.headers.set("Access-Control-Allow-Headers", "*")
response.headers.set("Access-Control-Allow-Methods", "GET,HEAD,POST,OPTIONS")
return response;
}const json = await context.request.json()
console.log(json.property);