0

Django: 4.0.6

Smartsheet Python SDK: 2.105.1

Ngrok: 3.0.6

I have a Django server running on localhost, forwarded my localhost through Ngrok, have setup a callback route for accepting/responding to the Smartsheet-Hook-Challenge, and created a webhook instance using Python SDK. However, when I try to enable my webhook by running the following (documented here):

Webhook = smartsheet_client.Webhooks.update_webhook(webhook_id,smartsheet_client.models.Webhook({'enabled': True}))

Ngrok immediately returns 502 bad gateway, and my webhook instance's disabledDetails attribute becomes Request returned HTTP status code 502 (ref id: wtegm9). And I have no clue what's the cause of this 502.

PS: While I'm writing this question, I was able to successfully enable my webhook using cURL command, so I can go ahead and start working. But enabling the same webhook instance with update_webhook python method still gives 502. Since updating webhook with cURL worked, could it be a bug in the Python SDK method itself?

1 Answers1

0

I would suspect that an issue with Ngrok is causing the 502 error and not a problem with the Smartsheet SDK. A Google search for http 502 bad gateway ngrok returns lots of info about 502 errors with Ngrok, including this Stack Overflow post which contains multiple widely approved answers:

Ngrok errors '502 bad gateway'

I'd start there, if I were you.

Kim Brandl
  • 13,125
  • 2
  • 16
  • 21
  • Hey Kim. Thank you for your response! The link you posted is actually the first few things I've tried, such as using "--host-header", or "explicitly specify local IP", but none of them worked for me. Furthermore, I thought cURL being successful on the same Ngrok forwarding URL eliminates the possibility of Ngrok being the issue. When I POST with cURL, Ngrok does give 200 and I did respond to the challenge successfully, so I feel like Ngrok might not be the issue, and the issue was in Python SDK. I didn't include your link in my question for that reason. – Bryan Han Aug 06 '22 at 13:46
  • Okay, fair enough. I don't have much experience with Ngrok, or with using the Python Smartsheet SDK to manage webhooks, but my hunch would still be that this issue is a problem with your local environment config, rather than an issue with the SDK. That said, you might consider creating an issue in the [Smarthsheet Python SDK GitHub repository](https://github.com/smartsheet-platform/smartsheet-python-sdk/issues?q=is%3Aissue+is%3Aopen) -- even if the issue is related with your local env config, perhaps someone with Smartsheet will provide helpful feedback via that channel. – Kim Brandl Aug 06 '22 at 21:05