Zeeshan
Zeeshan
Explore posts from servers
CDCloudflare Developers
Created by Zeeshan on 10/29/2024 in #general-help
issue with setting up dns records in managed domain in cloudflare
Hi folks, i have brought the domain from porkbun but i have now fully setup the records in cloudflare. now i want to connect my shopify store to the domain, specifically their A and CNAME records. is that possible with the current setup?
4 replies
CDCloudflare Developers
Created by Zeeshan on 9/21/2024 in #pages-help
How to get R2 to work with Astro?
I want to use CF R2 in Astro + CF Pages project, I have setup the domain and made the bucket public. But when i try to make a put into R2, it doesn't do anything. Am i doing anything wrong? is there a way to debug this? I'm using Astro's actions here
export const products = {
create: defineAction({
accept: "form",
input: z.object({
name: z.string(),
description: z.string(),
category: z.string(),
amount: z.number(),
image: z.instanceof(File).optional(),
}),
handler: async ({ name, description, category, amount, image }, ctx) => {
try {
// call to api to create product with the form inputs, and return `product_id`

let imageUrl = null;
if (image && image.size > 0) {
const fileExtension = image.name.split(".").pop();
const fileName = `${product_id}.${fileExtension}`;
await ctx.locals.runtime.env.CB_BUCKET.put(fileName, image);
imageUrl = `https://example.com/${fileName}`;
console.log("Image uploaded:", imageUrl);
}

return {
success: true,
message: "Product added successfully",
id: product_id,
};
} catch (error: unknown) {
console.error("Error adding a product", error);
const errorMessage =
error instanceof Error ? error.message : "An unknown error occurred";
return {
success: false,
message: `Failed to add product: ${errorMessage}`,
};
}
},
}),
};
export const products = {
create: defineAction({
accept: "form",
input: z.object({
name: z.string(),
description: z.string(),
category: z.string(),
amount: z.number(),
image: z.instanceof(File).optional(),
}),
handler: async ({ name, description, category, amount, image }, ctx) => {
try {
// call to api to create product with the form inputs, and return `product_id`

let imageUrl = null;
if (image && image.size > 0) {
const fileExtension = image.name.split(".").pop();
const fileName = `${product_id}.${fileExtension}`;
await ctx.locals.runtime.env.CB_BUCKET.put(fileName, image);
imageUrl = `https://example.com/${fileName}`;
console.log("Image uploaded:", imageUrl);
}

return {
success: true,
message: "Product added successfully",
id: product_id,
};
} catch (error: unknown) {
console.error("Error adding a product", error);
const errorMessage =
error instanceof Error ? error.message : "An unknown error occurred";
return {
success: false,
message: `Failed to add product: ${errorMessage}`,
};
}
},
}),
};
When i console log the env, I'm getting all cf related env's logged. the code runs and prints all the logs. I don't see any errors coming. Is there a way to debug R2? It worked at some point and then it didnt work. I guess it has something to do with env
12 replies
CDCloudflare Developers
Created by Zeeshan on 9/16/2024 in #pages-help
how to use production d1 db in local
hi folks, i'm new to db world i have my d1 database defined in format on my wrangler.toml file.
[[d1_databases]]
binding = "CB_DB" # i.e. available in your Worker on env.DB
database_name = "cherry-blossom"
database_id = db id here
[[d1_databases]]
binding = "CB_DB" # i.e. available in your Worker on env.DB
database_name = "cherry-blossom"
database_id = db id here
I'm able to use it on deployed link but when on local host. when i query using d1 syntax or even drizzle, i get error D1_ERROR: no such table: products: SQLITE_ERROR is there a workaround for it?
3 replies
DTDrizzle Team
Created by Zeeshan on 7/21/2024 in #help
i cant add more than 5-6 rows of data. is there a limit (using drizzle for d1 db)
hi folks, i want to dump a form data that is around 1200 rows, right now using db.insert(contactForm).values([{}, {}] i can only add a limited 3-4-5 entries at a time. is this a limitation with drizzle or d1? is there any other way to bulk insert data? thanks! update: d1 has 5GiB limit which seems to be more than enough https://arc.net/l/quote/wehuasbg
2 replies
CDCloudflare Developers
Created by Zeeshan on 7/18/2024 in #general-help
Can i create custom web hook with cloudflare workers?
I have a third party form builder which i'm embedding on my website. it accepts a webhook url. i want to connect a webhook url and capture the form submission data and push it to D1. Is it possible to do such a setup with cloudflare workers? for context I'm already running my wesbite on astro+cf
5 replies
CDCloudflare Developers
Created by Zeeshan on 7/16/2024 in #general-help
Possibility of using email routing while email hosted elsewhere?
No description
8 replies
CDCloudflare Developers
Created by Zeeshan on 7/15/2024 in #general-help
Getting Error 522 on my pages project
No description
5 replies
CDCloudflare Developers
Created by Zeeshan on 7/12/2024 in #general-help
transferring active domain to cf
Hi folks, my domain and lives in porkbun that will expire in 2026, im thinking of moving to cf because i plan to use cf's email routing and email routing needs full setup. I wanted to know if there is a charge or something i need to pay for this now? or should i pay only for renewing later when it expires in 2026? where can i know more about this? edit: (i also host my email in porkbun) one more question: i plan to use astro with cf. and i have an idea of sending the form submissions to my email using email worker and custom addresses, say for example, sending from [email protected] to [email protected] is it possible to leverage such a flow with using the current cloudflare's available products? Thanks in advance!
7 replies
CDCloudflare Developers
Created by Zeeshan on 7/12/2024 in #pages-help
Want to use workers with my astro site. Deployed to CF. What's next?
Hi folks, i have deployed my astro site to cf successfully. I want to know what's next. My end goal is to use cf functions for form submissions, and also use workers webhooks to listen to a third party tool. should i create a workers.toml file? if yes, is there a command to generate toml file without manually creating it? Also, if i want to use functions, should i use astro in ssr mode? thank you!
2 replies