Square Webhook: 504 Error in Production

Hello, I’m currently experiencing an issue with webhooks. Square seems to have difficulty reaching my Ngrok URLs when I’m in production, I always receive 504 error, but everything works fine in sandbox. In sandbox, with the same URL I am receiving status code 200.My ngrok supports “https” and I am sending a response as 200 for any incoming webhook. I am using the globally available Nodejs SDK.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Square Sandbox
Square Developer Tools
Troubleshoot In-App Payments SDK Problems

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Have you tried separating sandbox from production rather then having both configured to help debug?

Hi Bryan

At any point of time, either my sandbox is connected or my production. Both of them are not active at the same time.
My sandbox webhooks are working perfectly fine but my production webhooks return only 504 error code.