Yeah, then short of trying to rewrite all of the fs calls to R2/KV/whatever, there isn't much you ca
Yeah, then short of trying to rewrite all of the fs calls to R2/KV/whatever, there isn't much you can do
prince lib which calls the CLI to generate PDFs from HTML?prince should work on PagesNeither of these can run nodethis refers to functions and workers, right?
functions/[[path]].js and a functions/[[path]].js.map file. Do I expect stack traces to automatically use the sourcemap? Cause the logs are unreadable for me when I connect to a live function and an error happens.
tail.developers.workers.dev working right now?TypeError: Fetch API cannot load: /await on my call to the worker binding
princeprincetail.developers.workers.devTypeError: Fetch API cannot load: / "outcome": "canceled",
"response": {
"status": 200
}...
writeFileSync(`dist/${target}.html`, finalHtml);
await prince()
.license('./prince-license.xml')
.inputs(`dist/${target}.html`)
.output('dist/output.pdf')
.execute();
return new Response(readFileSync('dist/output.pdf'), {
... const request = new Request("/", payload);
const response = await env.WORKER_B.fetch(request);/**
* POST /api/submit
*/
export async function onRequestPost(context) {
try {
let input = await context.request.formData();
let pretty = JSON.stringify([...input], null, 2);
console.log(input.toString());
console.log("Sending Discord Message");
sendDiscordMessage("Website Contact Form", pretty, "https://discord.com/api/webhooks/1161255461614526525/");
return new Response(pretty, {
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
});
} catch (err) {
return new Response('Error parsing JSON content', { status: 400 });
}
}
async function sendDiscordMessage(name, message, webhookUrl) {
await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
username: 'Website Contact Form',
embeds: [{
title: 'New Message',
type: 'rich',
fields: [
{
name: 'Name',
value: name,
},
{
name: 'Message',
value: message,
}
]
}]
}),
});
console.log("Message Sent");
console.log(fetch)
}