triggerdotdev / trigger.dev

Trigger.dev is the open source background jobs platform for TypeScript.

Home Page:https://trigger.dev/changelog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: Replicate example keeps waiting

abhinavkulkarni opened this issue · comments

Provide environment information

  System:
    OS: macOS 14.1.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 57.72 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm

Describe the bug

Hi,

I'm currently running the example provided at Replicate integration docs and the image generation task keeps waiting for the result even though I can see the generated result in Replicate dashboard.

image

Reproduction repo

https://trigger.dev/docs/integrations/apis/replicate#usage

To reproduce

I have written a simple job as follows:

import { eventTrigger } from "@trigger.dev/sdk";
import { Replicate } from "@trigger.dev/replicate";
import { client } from "@/trigger";
import z from "zod";

const replicate = new Replicate({
  id: "replicate",
  apiKey: process.env.REPLICATE_API_KEY!,
});

client.defineJob({
  id: "replicate-create-prediction",
  name: "Replicate - Create Prediction",
  version: "0.1.0",
  integrations: { replicate },
  trigger: eventTrigger({
    name: "replicate.predict",
    schema: z.object({
      prompt: z
      .string()
      .default("rick astley riding a harley through post-apocalyptic miami"),
      version: z
      .string()
      .default("af1a68a271597604546c09c64aabcd7782c114a63539a4a8d14d1eeda5630c33"),
    }),
  }),
  run: async (payload, io, ctx) => {
    return io.replicate.predictions.createAndAwait("await-prediction", {
      version: payload.version,
      input: { prompt: payload.prompt },
    });
  },
});

Additional information

No response

I have the same issue. The run stops after a while and shows a disconnection error. I think it is because of the hobby plan. They will stop the run after 2-5 min.