Skip to content

TypeError: Illegal invocation | Cloudflare workers #134

@sanschaise

Description

@sanschaise

Trying to run replicate on cloudflare workers but can't seem to run any model:

const model =
    "stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478";
  const input = {
    prompt: "a 19th century portrait of a raccoon gentleman wearing a suit",
  };
  const output = await replicate.run(model, { input });

I keep getting this error:

A promise rejection was handled asynchronously. This warning occurs when attaching a catch handler to a promise after it rejected. (rejection #6)
Trace: TypeError: Illegal invocation
    at Object.apply (index.js:58:24)
    at withAutomaticRetries.shouldRetry.shouldRetry (index.js:507:70)
    at withAutomaticRetries (index.js:129:14)
    at async Replicate2.request (index.js:507:26)
    at async Replicate2.createPrediction (index.js:227:24)
    at async Replicate2.run (index.js:433:26)
    at async index.js:4629:14
    at async index.js:2745:7
    at async index.js:2072:62
    at async jsonError (index.js:4652:12) {
  stack: TypeError: Illegal invocation
    at Object.apply …2072:62
    at async jsonError (index.js:4652:12),
  message: Illegal invocation
}

I've tried overiding fetch but that doesn't seem to solve the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions