502 Bad Gateway response for webhooks

Hi team, I’ve been working on some new webhooks this evening and I’m getting a 502 bad gateway error response when posting to them. I’ve also deployed triggers at the same time and they are working as expected.

I’ve not had this problem with previous webhooks that I’ve worked on in 8base, so I’m not sure if there is a platform issue or something wrong with my handlers.

Hi,

  1. Can you please try to add logs to the beginning of your code and check if webhook was called at all
  2. 502 error might happen when you don’t do JSON.stringify for body.
    https://docs.8base.com/8base-console/custom-functions/webhooks
return {
  statusCode: 200,
  body: JSON.stringify({ message: "Hello World!" })
}
2 Likes

Thanks @evgeny.semushin, stringifying the body did the trick.

1 Like