Skip to content

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

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

D-K-P
Copy link
Member

@D-K-P D-K-P commented Sep 17, 2024

No description provided.

Copy link

changeset-bot bot commented Sep 17, 2024

⚠️ No Changeset found

Latest commit: f0969b1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR


## 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:
Copy link
Member

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({
Copy link
Member

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/

Copy link

pkg-pr-new bot commented Sep 17, 2024

pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/build@1312
pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev@1312
pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/core@1312
pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/sdk@1312

commit: f0969b1


### Task code

<Warning>
Copy link
Member

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}`;
Copy link
Member

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 }) => {
Copy link
Member

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

@D-K-P D-K-P merged commit a84e601 into main Sep 17, 2024
9 checks passed
@D-K-P D-K-P deleted the docs/task-examples-ffmpeg-sharp-vercel branch September 26, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants