Skip to content

Commit d546ab3

Browse files
committed
test problematic packages
1 parent 99d5664 commit d546ab3

File tree

3 files changed

+96
-3
lines changed

3 files changed

+96
-3
lines changed

references/v3-catalog/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
"generate:prisma": "prisma generate --sql"
1717
},
1818
"dependencies": {
19+
"@1password/sdk": "^0.3.0",
1920
"@effect/schema": "^0.75.5",
20-
"@infisical/sdk": "^2.1.9",
21+
"@infisical/sdk": "^2.3.5",
2122
"@opentelemetry/api": "1.4.1",
2223
"@prisma/client": "5.19.0",
2324
"@react-email/components": "0.0.24",
@@ -32,13 +33,16 @@
3233
"@typeschema/typebox": "^0.14.0",
3334
"ai": "^3.3.24",
3435
"arktype": "2.0.0-rc.17",
36+
"bcrypt": "^6.0.0",
37+
"canvas": "^3.1.0",
3538
"dotenv": "^16.4.5",
3639
"email-reply-parser": "^1.8.0",
3740
"execa": "^8.0.1",
3841
"fluent-ffmpeg": "^2.1.3",
3942
"header-generator": "^2.1.55",
4043
"kysely": "^0.27.4",
4144
"msw": "^2.2.1",
45+
"mupdf": "^1.3.6",
4246
"openai": "^4.47.0",
4347
"pg": "^8.11.5",
4448
"playwright": "^1.50.1",
@@ -48,13 +52,16 @@
4852
"reflect-metadata": "^0.1.13",
4953
"runtypes": "^6.7.0",
5054
"server-only": "^0.0.1",
55+
"sharp": "^0.34.2",
56+
"sqlite3": "^5.1.7",
5157
"stripe": "^12.14.0",
5258
"superstruct": "^2.0.2",
5359
"typeorm": "^0.3.20",
5460
"valibot": "^0.42.1",
5561
"wrangler": "3.70.0",
5662
"yt-dlp-wrap": "^2.3.12",
5763
"yup": "^1.4.0",
64+
"zip-node-addon": "^0.0.11",
5865
"zod": "3.23.8"
5966
},
6067
"devDependencies": {
@@ -75,6 +82,7 @@
7582
"@opentelemetry/semantic-conventions": "^1.22.0",
7683
"@trigger.dev/build": "workspace:*",
7784
"@trigger.dev/python": "workspace:*",
85+
"@types/bcrypt": "^5.0.2",
7886
"@types/email-reply-parser": "^1.4.2",
7987
"@types/fluent-ffmpeg": "^2.1.26",
8088
"@types/react": "^18.3.1",

references/v3-catalog/src/trigger/binaries.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,87 @@ import * as path from "node:path";
44
import { Readable } from "node:stream";
55
import type { ReadableStream } from "node:stream/web";
66

7+
import bcrypt from "bcrypt";
8+
9+
const saltRounds = 10;
10+
const myPlaintextPassword = "s0//P4$$w0rD";
11+
const someOtherPlaintextPassword = "not_bacon";
12+
13+
bcrypt.genSalt(saltRounds, function (err, salt) {
14+
bcrypt.hash(myPlaintextPassword, salt, function (err, hash) {
15+
// Store hash in your password DB.
16+
});
17+
});
18+
19+
import { InfisicalClient } from "@infisical/sdk";
20+
21+
const infisicalClient = new InfisicalClient({
22+
siteUrl: "https://example.com",
23+
});
24+
25+
import * as mupdf from "mupdf";
26+
27+
// Helper function to load document from URL
28+
async function loadDocumentFromUrl(url: string): Promise<mupdf.Document> {
29+
try {
30+
const response = await fetch(url);
31+
const buffer = await response.arrayBuffer();
32+
return mupdf.Document.openDocument(buffer, "application/pdf");
33+
} catch (error) {
34+
throw new Error(`Failed to load document from URL: ${url}`);
35+
}
36+
}
37+
38+
import zip from "zip-node-addon";
39+
40+
function unzip(inputPath: string, outputPath: string) {
41+
zip.unzipFile(inputPath, outputPath);
42+
}
43+
44+
import { createClient } from "@1password/sdk";
45+
46+
// Creates an authenticated client.
47+
const client = await createClient({
48+
auth: process.env.OP_SERVICE_ACCOUNT_TOKEN ?? "",
49+
// Set the following to your own integration name and version.
50+
integrationName: "My 1Password Integration",
51+
integrationVersion: "v1.0.0",
52+
});
53+
54+
// Fetches a secret.
55+
// const secret = await client.secrets.resolve("op://vault/item/field");
56+
57+
import sharp from "sharp";
58+
import sqlite3 from "sqlite3";
59+
import { createCanvas } from "canvas";
60+
61+
// Test sharp: create a 1x1 PNG buffer
62+
const sharpBufferPromise = sharp({
63+
create: {
64+
width: 1,
65+
height: 1,
66+
channels: 4,
67+
background: { r: 0, g: 0, b: 0, alpha: 0 },
68+
},
69+
})
70+
.png()
71+
.toBuffer();
72+
73+
// Test sqlite3: open an in-memory database
74+
const sqliteDb = new sqlite3.Database(":memory:", (err) => {
75+
if (err) {
76+
console.error("sqlite3 error:", err);
77+
} else {
78+
console.log("sqlite3 in-memory database opened");
79+
}
80+
});
81+
82+
// Test canvas: create a 100x100 canvas and draw a rectangle
83+
const canvas = createCanvas(100, 100);
84+
const ctx = canvas.getContext("2d");
85+
ctx.fillStyle = "red";
86+
ctx.fillRect(10, 10, 80, 80);
87+
788
export const convertVideo = task({
889
id: "convert-video",
990
retry: {

references/v3-catalog/trigger.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
33
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";
44
import { esbuildPlugin } from "@trigger.dev/build";
55
import { audioWaveform } from "@trigger.dev/build/extensions/audioWaveform";
6-
import { ffmpeg, syncEnvVars } from "@trigger.dev/build/extensions/core";
6+
import { additionalFiles, ffmpeg, syncEnvVars } from "@trigger.dev/build/extensions/core";
77
import { puppeteer } from "@trigger.dev/build/extensions/puppeteer";
88
import { playwright } from "@trigger.dev/build/extensions/playwright";
99
import { prismaExtension } from "@trigger.dev/build/extensions/prisma";
@@ -15,7 +15,6 @@ export default defineConfig({
1515
project: "yubjwjsfkxnylobaqvqz",
1616
machine: "medium-1x",
1717
instrumentations: [new OpenAIInstrumentation()],
18-
additionalFiles: ["wrangler/wrangler.toml"],
1918
maxDuration: 3600,
2019
dirs: ["./src/trigger"],
2120
retries: {
@@ -32,7 +31,11 @@ export default defineConfig({
3231
logLevel: "info",
3332
build: {
3433
conditions: ["react-server"],
34+
autoDetectExternal: true,
3535
extensions: [
36+
additionalFiles({
37+
files: ["./wrangler/wrangler.toml"],
38+
}),
3639
ffmpeg(),
3740
emitDecoratorMetadata(),
3841
audioWaveform(),
@@ -48,6 +51,7 @@ export default defineConfig({
4851
org: "triggerdev",
4952
project: "taskhero-examples-basic",
5053
authToken: process.env.SENTRY_AUTH_TOKEN,
54+
telemetry: false,
5155
}),
5256
{ placement: "last", target: "deploy" }
5357
),

0 commit comments

Comments
 (0)