exactly another victim like me
exactly another victim like me
index.ts, im sure you are doing export default app right nowscheduled should look like this ?Please keep the discussion here friendly, if you want help.


import { Resvg, ResvgRenderOptions, initWasm } from '@resvg/resvg-wasm';
import wasmModule from '@resvg/resvg-wasm/index_bg.wasm';
export const generateImage = async (text: string) => {
console.log(text, "this is the text");
const svg = ;
try {
await initWasm(wasmModule);
} catch (error) {
console.error('Resvg wasm not initialized');
throw error;
}
const opts: ResvgRenderOptions = {
background: "white", // Optional: set background color
fitTo: {
mode: "width",
value: 600, // Adjust based on your needs
},
font: {
loadSystemFonts: true, // Disable system fonts if you're using custom fonts
},
};
const resvg = new Resvg(svg, opts);
console.log(resvg, "this is the resvg");
const pngData = resvg.render();
const pngBuffer = pngData.asPng();
return pngBuffer;
};fontBuffer is a raw ttffs of course, but worth a try)
import { DurableObject } from "cloudflare:workers";Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'cloudflare:'@cloudflare/workers work?export default appscheduledasync scheduled(
controller: ScheduledController,
env: Env,
ctx: ExecutionContext,
) {
console.log("cron processed");
},Please keep the discussion here friendly, if you want help.import { Resvg, ResvgRenderOptions, initWasm } from '@resvg/resvg-wasm';
import wasmModule from '@resvg/resvg-wasm/index_bg.wasm';
export const generateImage = async (text: string) => {
console.log(text, "this is the text");
const svg = ;
try {
await initWasm(wasmModule);
} catch (error) {
console.error('Resvg wasm not initialized');
throw error;
}
const opts: ResvgRenderOptions = {
background: "white", // Optional: set background color
fitTo: {
mode: "width",
value: 600, // Adjust based on your needs
},
font: {
loadSystemFonts: true, // Disable system fonts if you're using custom fonts
},
};
const resvg = new Resvg(svg, opts);
console.log(resvg, "this is the resvg");
const pngData = resvg.render();
const pngBuffer = pngData.asPng();
return pngBuffer;
};fontBufferttffsimport { DurableObject } from "cloudflare:workers";Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'cloudflare:'@cloudflare/workersexport default {
fetch: app.fetch,
async scheduled(
controller: ScheduledController,
env: Env,
ctx: ExecutionContext
) {
....
}
}font: {
fontsBuffers: [fontBuffer], //
},