replicate / replicate-javascript

Node.js client for Replicate
https://replicate.com/docs/get-started/nodejs
Apache License 2.0
473 stars 193 forks source link

document how to use (and validate) webhooks #195

Closed zeke closed 4 months ago

zeke commented 8 months ago

We should update the README with an example of how to set a webhook.

This page has some prior art: https://replicate.com/docs/webhooks#setting-webhooks

await replicate.predictions.create({
  version: "d55b9f2d...",
  input: { prompt: "call me later maybe" },
  webhook: "https://example.com/replicate-webhook",
  webhook_events_filter: ["completed"], // optional
});
platform-kit commented 7 months ago

@zeke Is this info still accurate? Some time in the last few days all the webhooks for my app have stopped working. Need a solution ASAP.

zeke commented 7 months ago

@platform-kit this should still work. Please email team@replicate.com and share some details about the predictions you ran that have failing webhooks.

platform-kit commented 7 months ago

Just did that.

Sharing this here too for posterity - https://discord.com/channels/775512803439280149/1203740306722398268/1204514916074266714

Just like the other users report, it's ALL predictions.

Pwntus commented 7 months ago

This was solved: https://discord.com/channels/775512803439280149/1203740306722398268

zeke commented 7 months ago

Thanks @platform-kit and @Pwntus for following up. 👍🏼

zeke commented 7 months ago

Whoops re-opening because we still need to document webhooks here. 😅

mattt commented 7 months ago

@zeke See also #200

lukeingalls commented 6 months ago

One thing that caught me by surprise with webhooks is that a 301 error silently fails to deliver. I hadn't realized the route I had provided, domain.com/api/..., was returning 301 to www.domain.com/api/.... It'd be nice if the redirect was followed or to be able to see in the web interface the status of webhook deliveries.

If there's a better place to raise this LMK.

zeke commented 6 months ago

Hey @lukeingalls thanks for reporting. Checking with our webhook provider to see if we can support following redirects.

zeke commented 6 months ago

@lukeingalls our webhook service doesn't support following redirects, and is not likely to. You will need to use the ultimate destination URL when specifying your webhook.

It'd be nice [...] to be able to see in the web interface the status of webhook deliveries.

☝🏼 Yeah that's a great suggestion. I've made a ticket for this internally.

AurelTBE commented 6 months ago

Hi, I had the same issue between "domain.com/api/..." and "www.domain.com/api/..." for my webhook. It would be nice to add a "warning" or attention drawing in the documentation, to avoid other people getting this issue if it can't be changed.