# 503 Error When Testing With Webhooks

**URL:** <https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055>\
**Category:** Questions\
**Tags:** customers-api, sandbox\
**Created:** [December 29, 2022, 2:29am UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055 "2022-12-29T02:29:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajd249](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@ajd249](https://developer.squareup.com/forums/u/ajd249)\
**Post date:** [December 29, 2022, 2:29am UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/1 "2022-12-29T02:29:56Z")

</div>

Hello, my previous post was automatically hidden because the system thought it was spam.

Here is the original link that explains it all: [https://developer.squareup.com/forums/t/503-error-when-using-webhook-api/8053](https://developer.squareup.com/forums/t/503-error-when-using-webhook-api/8053)

If you can help me, that would be great. Thank you!

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 29, 2022, 4:41pm UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/2 "2022-12-29T16:41:56Z")

</div>

Are you using one of our examples for verifying the webhook? A `503` would be coming from your server which means that Square didn’t get the `2xx` response within 10 seconds. Is a `503` also returned with test webhooks? 🙂

---

<div class="post-metadata">

**Author:** ![ajd249](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@ajd249](https://developer.squareup.com/forums/u/ajd249)\
**Post date:** [December 29, 2022, 7:10pm UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/3 "2022-12-29T19:10:21Z")

</div>

Hi Bryan,

Thank you for the reply.

I am using the example from the documentation, but had to adapt it because I am using Express.

Here is my code:

```auto
exports.square_account_created = async (req, res, next) => {
  // The URL where event notifications are sent.
  const NOTIFICATION_URL = 'https://ajd249rdaproject.website:3000/auth/square_account_created';
  // The signature key defined for the subscription.
  const SIGNATURE_KEY = ' ************';
  // isFromSquare generates a signature from the url and body and compares it to the Square signature header.
  function isFromSquare(signature, body) {
    const hmac = crypto.createHmac('sha256', SIGNATURE_KEY);
    hmac.update(NOTIFICATION_URL + body);
    const hash = hmac.digest('base64');
    return hash === signature;
  }

  try {
    const signature = req.headers['x-square-hmacsha256-signature'];
    if (isFromSquare(signature, req.body)) {
      res.sendStatus(200);
      console.info("Request body: " + req.body);
    } else {
      res.sendStatus(403);
    }
    res.end()
  } catch (error) {
    if (!err.statusCode) {
      err.statusCode = 500;
    }
    next(err);
  }
}

```

Note that I did put the correct signature key from my webhook subscription. I tested it using Postman and it works when sending a POST request to the notification URL. However, when I try it with the ‘send test event’ I get a 503 error.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 29, 2022, 8:53pm UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/4 "2022-12-29T20:53:31Z")

</div>

When I go to the site URL I’m getting a not found. Is the URL valid? 🙂

---

<div class="post-metadata">

**Author:** ![ajd249](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@ajd249](https://developer.squareup.com/forums/u/ajd249)\
**Post date:** [December 29, 2022, 9:01pm UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/6 "2022-12-29T21:01:33Z")

</div>

Yes the URL is valid. The: {“error”:{“message”:“SOMETHING WRONG WRONG 404 - Not found.”}}  
you see is just something I put there for default if you are trying to make a request that I did not set up. Entering the URL in the browser is making a GET request that I did not set anything for so it defaults to my generic response of 404 not found text. If you make a POST request to that URL though something different will happen. It would run the function I posted previously.

---

<div class="post-metadata">

**Author:** ![ajd249](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@ajd249](https://developer.squareup.com/forums/u/ajd249)\
**Post date:** [December 30, 2022, 5:36pm UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/7 "2022-12-30T17:36:36Z")

</div>

I just wanted to say that I solved it. It ended up being that I did not bundle my ca-bundle.crt and certificate.crt files for my SSL to verify it. I noticed that this was an issue in Postman because it said that it had trouble verifying it so figured maybe it’s an SSL issue.

Low and behold, I got the Postman issue to go away by verifying it properly and then webhooks worked!

 ![7ec0be95e97b44a1f753ca5357aad548](https://global.discourse-cdn.com/square/original/2X/1/142e6bae21b3c7d41fba4887ba8f29358049afcf.png)

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 30, 2022, 6:30pm UTC](https://developer.squareup.com/forums/t/503-error-when-testing-with-webhooks/8055/8 "2022-12-30T18:30:20Z")

</div>

Great! Glad to hear you figured it out. 🙂
