Yakuzo
Yakuzo
Explore posts from servers
CDCloudflare Developers
Created by Yakuzo on 4/22/2024 in #workers-help
Workers JSRPC Pricing
Hello, after searching through a good deal of the documentation and blogs concerning workers, there's one piece of information that's missing, but I think it's due to its very recent nature. The pricing on workers is really clear and on this point I have no worries. But I'd like to know more about JS RPC. When a worker makes an RPC call to another worker, does this count as several requests or just one? If I were to create a microservice for CORS management, one for token management and other uses, I could easily come up with a request that counts as 3 if that's the case. This can quickly become quite substantial if badly managed, and could make me think entirely about my microservices architecture. Thanks in advance for your reply.
6 replies
PPrisma
Created by Yakuzo on 4/15/2024 in #help-and-questions
Unknown argument xx. Available options are marked with ?.
Hi everyone, I have an error that I can't solve and I wanted to know if anyone sees an error in my model? I've been stuck on it for a while and I don't really understand why, even though everything seems right. IIt can either be linked to a Track or a Car (not both at the same time), which is why I've added the null option.
model ModsImages {
id String @id @unique
parent_id String
parent_type String
full_name String
name String
type String
metadata Json?
url String
car Cars? @relation("CarImage", fields: [parent_id], references: [signature], map: "mods_images_car_fkey")
track Tracks? @relation("TrackImage", fields: [parent_id], references: [signature], map: "mods_images_track_fkey")

@@map("mods_images")
}

model Cars {
signature String @id @unique
...
images ModsImages[] @relation("CarImage")
...

@@index([variant_of])
@@map("cars")
}
model ModsImages {
id String @id @unique
parent_id String
parent_type String
full_name String
name String
type String
metadata Json?
url String
car Cars? @relation("CarImage", fields: [parent_id], references: [signature], map: "mods_images_car_fkey")
track Tracks? @relation("TrackImage", fields: [parent_id], references: [signature], map: "mods_images_track_fkey")

@@map("mods_images")
}

model Cars {
signature String @id @unique
...
images ModsImages[] @relation("CarImage")
...

@@index([variant_of])
@@map("cars")
}
* I'm creating my Car and all his content with "create" method inside a transaction and create image in it :
const images: Prisma.ModsImagesCreateManyInput[] = car?.images?.map(
(image) => {
const metadata = JSON.parse(JSON.stringify(image.metadata)) ?? null;
console.log("Metadata : ", metadata);
console.log("Image : ", image);

return {
id: image.id,
parent_id: car.signature,
full_name: image.full_name,
name: image.name,
type: image.type,
metadata,
url: image.url,
parent_type: "cars",
};
}
);
...

await transaction.cars.create({
data: {
signature: car.signature,
...
images: {
create: images,
},
s3_folder: {
create: [],
},
},
const images: Prisma.ModsImagesCreateManyInput[] = car?.images?.map(
(image) => {
const metadata = JSON.parse(JSON.stringify(image.metadata)) ?? null;
console.log("Metadata : ", metadata);
console.log("Image : ", image);

return {
id: image.id,
parent_id: car.signature,
full_name: image.full_name,
name: image.name,
type: image.type,
metadata,
url: image.url,
parent_type: "cars",
};
}
);
...

await transaction.cars.create({
data: {
signature: car.signature,
...
images: {
create: images,
},
s3_folder: {
create: [],
},
},
Thanks in advance
2 replies
CDCloudflare Developers
Created by Yakuzo on 2/20/2024 in #workers-help
Is it possible to send mail in a worker ?
Hi, I'm looking to send mail from a worker where SMTP identifiers would be dynamic because I have several addresses from an API. I just realized that nodemailer seems to be a problem on workers. Is there an alternative?
5 replies