-
-
Notifications
You must be signed in to change notification settings - Fork 724
Added new example tasks (FFmpeg / Sharp / Vercel AI SDK) #1312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
## Adding the FFmpeg build extension | ||
|
||
To use these example tasks, you'll first need to add our FFmpeg extension to your project configuration like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably mention the need to add @trigger.dev/build
to your devDependencies
if it already isn't there (init
will now add it).
import path from "path"; | ||
|
||
// Initialize S3 client for R2 storage | ||
const s3Client = new S3Client({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd link to this document about how to authenticate to R2: https://developers.cloudflare.com/r2/api/s3/tokens/
commit: |
|
||
### Task code | ||
|
||
<Warning> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give people example URLs they can use
|
||
// Upload the thumbnail to R2 and get the public URL | ||
await s3Client.send(new PutObjectCommand(uploadParams)); | ||
const s3Url = `https://${process.env.S3_BUCKET}.s3.amazonaws.com/${s3Key}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL is incorrect, it's pointing to aws, not R2
|
||
export const sharpProcessImage = task({ | ||
id: "sharp-process-image", | ||
run: async (payload: { imageUrl: string; watermarkUrl: string }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, it would be cool to supply some example URLs
No description provided.