How do I send 200 response to shopify webhook using koa.js.

fremfi
Tourist
10 0 2

I receive the webhook but Shopify thinks it failed.

Here is my code

 

```

router.post("/webhooks/customers/create", webhook, async (ctx) => {
console.log("received state: ", ctx.state.webhook);
 
ctx.response.status = 200;
return;
});
```
I also tried,
// ctx.res.statusCode = 200;
// ctx.res.write("OK");
// ctx.res.end();
Replies 3 (3)

Visely-Team
Shopify Partner
1843 210 488

Use ctx.status = 200;  you can also omit the return.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
yanteb
Shopify Partner
34 0 4

I did ctx.status = 200 on one line and on the next line I did ctx.body ={} and I'm still getting "your webhook is failing emails" any ideas?

dgtlmonk
Shopify Partner
38 3 7

same issue