replicate/replicate-javascript

Not assignable to parameter of type '`${string}/${string}:${string}`

royherma opened this issue · 5 comments

I'm trying to use the latest Flux Schnell in my Node.js backend via the API.

But in the documentation, there is no version or additional identifier after the colon. This causes me to get an error as below.

Argument of type '"black-forest-labs/flux-schnell"' is not assignable to parameter of type '${string}/${string}:${string}

When I try running it without the colon, I also get an error that the entity cannot be processed.

Any ideas about how to fix this? It does look like I have the latest npm version which is replicate 0.32

Screenshot 2024-09-09 at 7 24 48
mattt commented

Hi @royherma. That's unexpected, since the type definition for run allows with and without version ID:

identifier: `${string}/${string}` | `${string}/${string}:${string}`,

Curious to know, does this error go away if you inline the argument to a string literal?

@mattt mine looks a bit different..

run(
  identifier: `${string}/${string}:${string}`,
  options: {
    input: object;
    wait?: boolean | { interval?: number; maxAttempts?: number };
    webhook?: string;
    webhook_events_filter?: WebhookEventType[];
  }
): Promise<object>;

and see image as well:

Screenshot 2024-09-10 at 7 59 05

node.js
"replicate": "^0.32.1",

any ideas?

nvm - fixed! It does look like I had an older version that was just a mismatch in what my package said and what was actually installed.

I uninstalled it - and then reinstalled to the latest version and it now worked.

However, it looks like this update is causing some issues with my firebase node backend.

@mattt Does this latest version of replicate not work on Node 14?

mattt commented

@royherma Node 18 is the minimum supported version for the Replicate library. I'd recommend upgrading from Node 14.

For sure, thank you. We can close this :) @mattt