salad
salad
CDCloudflare Developers
Created by salad on 2/12/2024 in #pages-help
Cloudflare Could not load virtual:astro-icon
I was trying to update something on my cloudflare pages site, and suddenly I'm getting the following error. All I did was change an HTML lang tag. I'm guessing Astro Icons have changed in some way since 2 months ago?
17:21:39.655 > astro build
17:21:39.655
17:21:42.210 10:21:42 PM [content] Types generated 249ms
17:21:42.211 10:21:42 PM [build] output target: static
17:21:42.211 10:21:42 PM [build] Collecting build info...
17:21:42.212 10:21:42 PM [build] Completed in 609ms.
17:21:42.214 10:21:42 PM [build] Building static entrypoints...
17:21:44.689 [astro-icon] Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 error Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 TypeError: Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.977 at logCollections (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:46:12)
17:21:44.977 at Object.load (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:30:17)
17:21:44.977 at async PluginDriver.hookFirstAndGetPlugin (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
17:21:44.977 at async file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:24611:75
17:21:44.977 at async Queue.work (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25654:32)
17:21:45.067 Failed: build command exited with code: 1
17:21:46.003 Failed: error occurred while running build command
17:21:39.655 > astro build
17:21:39.655
17:21:42.210 10:21:42 PM [content] Types generated 249ms
17:21:42.211 10:21:42 PM [build] output target: static
17:21:42.211 10:21:42 PM [build] Collecting build info...
17:21:42.212 10:21:42 PM [build] Completed in 609ms.
17:21:42.214 10:21:42 PM [build] Building static entrypoints...
17:21:44.689 [astro-icon] Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 error Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 TypeError: Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.977 at logCollections (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:46:12)
17:21:44.977 at Object.load (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:30:17)
17:21:44.977 at async PluginDriver.hookFirstAndGetPlugin (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
17:21:44.977 at async file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:24611:75
17:21:44.977 at async Queue.work (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25654:32)
17:21:45.067 Failed: build command exited with code: 1
17:21:46.003 Failed: error occurred while running build command
Deployment works on my machine with the same version of Node and npm as Cloudflare. Any ideas?
4 replies
CDCloudflare Developers
Created by salad on 2/5/2024 in #general-help
NTLM Authentication to Zero Trust Application available through Cloudflare Tunnel
Has anyone been able to setup a ZTA in Cloudflare that "forwards" their NTLM authentication to an internal web resource (IIS) hosted behind a Cloudflare tunnel?
1 replies
CDCloudflare Developers
Created by salad on 6/9/2023 in #workers-help
Set reply-to email in Mailchannels api request
Is there a way to set a reply-to email on my mail send worker? People fill in a form and set their email, I then send the form to myself and set their email as a mailto link. I would like to set a reply-to header instead. The relevant code so far looks roughly as such:
let sendRequest = new Request("https://api.mailchannels.net/tx/v1/send", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: "[email protected]" }]
}
],
from: {
},
subject: `Contact Us - ${form.lname}, ${form.fname} (${form.subject})`,
content: [
{
type: "text/html",
value: `<h2>Subject: ${form.subject}</h2>

<p style="background-color: lightgray; padding: 10px; max-width: 1250px;">
${form.message}
</p>

<h2><strong>Email: <a href="mailto:${form.email}">${form.email}</a></strong></h2>`
}
]
})
});
let sendRequest = new Request("https://api.mailchannels.net/tx/v1/send", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: "[email protected]" }]
}
],
from: {
},
subject: `Contact Us - ${form.lname}, ${form.fname} (${form.subject})`,
content: [
{
type: "text/html",
value: `<h2>Subject: ${form.subject}</h2>

<p style="background-color: lightgray; padding: 10px; max-width: 1250px;">
${form.message}
</p>

<h2><strong>Email: <a href="mailto:${form.email}">${form.email}</a></strong></h2>`
}
]
})
});
2 replies
CDCloudflare Developers
Created by salad on 5/26/2023 in #general-help
Can't add domain to Cloudflare
I work for a municipal government in Quebec, so we have a domain name like this: ville.<our_city>.qc.ca (i.e.: ville.ddo.qc.ca, ville.pointe-claire.qc.ca, etc.) Because of this weird domain name format, Cloudflare detects it as being a subdomain and only allows me to add <our_city>.qc.ca. This isn't possible, as that isn't our domain. Has anyone had a similar type of issue?
13 replies
CDCloudflare Developers
Created by salad on 2/7/2023 in #pages-help
Error with @cloudflare/next-on-pages
Hi guys, trying to deploy a site with next and running into the following error when running npx @cloudflare/next-on-pages --experimental-minify:
@cloudflare/next-to-pages CLI
⚡️
⚡️ Installing 'vercel' CLI...
⚡️
node:events:491
throw er; // Unhandled 'error' event
^

Error: spawn npm ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'install', '-D', 'vercel' ]
}

Node.js v18.12.1
@cloudflare/next-to-pages CLI
⚡️
⚡️ Installing 'vercel' CLI...
⚡️
node:events:491
throw er; // Unhandled 'error' event
^

Error: spawn npm ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'install', '-D', 'vercel' ]
}

Node.js v18.12.1
7 replies
CDCloudflare Developers
Created by salad on 2/5/2023 in #workers-help
Get request headers from received request in fetch event.
I am trying to get the headers of received requests, but end up getting null for the following code:
export default {
async fetch(request, env, ctx) {
console.log(JSON.stringify(request.headers));
}
}
export default {
async fetch(request, env, ctx) {
console.log(JSON.stringify(request.headers));
}
}
5 replies
CDCloudflare Developers
Created by salad on 1/21/2023 in #workers-help
Mail sees 2 from addresses when name enabled
I have the following script:
const sendForm = async (form) => {
let sendRequest = new Request('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: '[email protected]' }],
},
],
from: {
email: form.email,
name: `${form.lname}, ${form.fname}`, // Causes an ERROR (multiple from addresses)
},
subject: `Contact Us - ${form.lname}, ${form.fname} (${form.subject})`,
content: [
{
type: 'text/html',
value: form.message,
},
],
}),
});

const response = await fetch(sendRequest);
const responseText = await response.text();

return responseText;
};
const sendForm = async (form) => {
let sendRequest = new Request('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: '[email protected]' }],
},
],
from: {
email: form.email,
name: `${form.lname}, ${form.fname}`, // Causes an ERROR (multiple from addresses)
},
subject: `Contact Us - ${form.lname}, ${form.fname} (${form.subject})`,
content: [
{
type: 'text/html',
value: form.message,
},
],
}),
});

const response = await fetch(sendRequest);
const responseText = await response.text();

return responseText;
};
And I don't really understand why... after all the from: field is an object, not an array... The form input is good, there are no issues there
2 replies