Uninstalled Webhook not firing

Solved
TezWingfield83
Tourist
14 0 1

Hi All,

This is driving me bonkers! I've literally rewrote my func four times to try and understand why I'm not receiving an uninstalled event.

 

Ok, So, I'm testing locally via ngrok. I've spent the best part of the day wiring up the auth, all is working fine except, uninstalling.

 

topic: app/uninstalled

address: https://******.ngrok.io/shopify/uninstall

format: json.

 

I log the response from the api (looks good), I can see the hook via postman (GET request)

 

I've stripped out all the code on the uninstalled endpoint on my mvc app and I'm left with:

 

[HttpPost]
public IActionResult Index()
{
return new OkResult();
}

 

It's just not being hit.

Please can someone point me in the right direction?

 

Stay Safe,

 

 

0 Likes
TezWingfield83
Tourist
14 0 1

Bump...

 

Anyone else seeing these problems? I really could do with a tech rep from shopify to help identify the issues.

 

I've tested again this morning, leaving the dev/ngrok server running incase of delay... but 30mins in, and still no data received. 

 

Are there any reported issues using ngrok in a test env? How can I tell if the shopify system even attempted to make this call? Happy to share further details in a private message.

 

Regards,

0 Likes
TezWingfield83
Tourist
14 0 1

Bump Bump...

 

Anyone? I take it the Shopify team don't work on the weekends. No rotating team I guess.

 

0 Likes
HunkyBill
Shopify Expert
4509 46 492

If your App is not getting hit with a webhook, 99% of the time the problem is, you have not configured your App correctly. So you say Postman registers the hit. Great. Now when you examine the webhook you setup in the App you're about to uninstall, you are 100% certain you did that step correctly, and you see your topic and endpoint perfect right?

Only in that case would I even pretend there is a problem with Shopify... 99% of the time, the problem was me. And what I did. And the DUH moments are there.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
TezWingfield83
Tourist
14 0 1

Evening Bill,

Thank you very much for the reply. It's truly appreciated.

I completely agree that mistakes and bugs can happen. My day job is a software engineer, so I'm well versed in the art of developing systems.

 

So, My auth is working. During the callback process, I call the POST webhook endpoint, which certainly creates the hook. The resp from the call:

{"webhook":{"id":****,"address":"https:\/\/****ngrok.io\/shopify\/uninstall\/index\/","topic":"app\/uninstalled","created_at":"2021-04-18T20:33:08+01:00","updated_at":"2021-04-18T20:33:08+01:00","format":"json","fields":[],"metafield_namespaces":[],"api_version":"2021-04","private_metafield_namespaces":[]}}

I also store the config to a table:

topic: app/uninstalled

address: https://****.ngrok.io/shopify/uninstall/index/

format: json

And finally when I get all webhooks using postman, I can certainly see the one I created:

 

        {
            "id"****,
            "address""https://***.ngrok.io/shopify/uninstall/index/",
            "topic""app/uninstalled",
            "created_at""2021-04-18T20:33:08+01:00",
            "updated_at""2021-04-18T20:33:08+01:00",
            "format""json",
            "fields": [],
            "metafield_namespaces": [],
            "api_version""2021-04",
            "private_metafield_namespaces": []
        }

 

I've now included a logging method and left my dev server running:

 

[HttpPost]
public async Task<IActionResult> Index()
{

_loggerHelper.Log(LogType.Database, "UninstallController.cs", "Uninstall", "Uninstall Endpoint Hit!");
return new OkResult();
}

 

You say not configured app? Are you referring to the app in shopify (Create App section). Do I need to whitelist some where?

 

And finally if I take my url "uninstall" change the verb to post in postman, I can hit my own app... I really wish there was a "DUH" moment but I'm not seeing it.

 

Regards,

 

 

 

 

 

0 Likes
HunkyBill
Shopify Expert
4509 46 492

What I meant is, your App is probably not configured properly at the endpoint. Shopify is almost certainly sending you the webhook if you are uninstalling the App. If your endpoint remains unhit, it is likely you are either not listening to the right endpoint with the right verb... or something else is misconfigured. As I said before, there will likely be a duh moment for you.

There is nothing to whitelist. If you set a webhook in an App, and you checked it exists, and you trigger it, you should receive it. In your case, not receiving it is probably due to a config.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
TezWingfield83
Tourist
14 0 1

Hi Bill,

 

Still not found the issue, it makes it tremendously difficult if I cannot see what's being returned when shopify attempts to make the call. Surly there's an event stream somewhere?

 

Taking a screen shot of my dashboard, If the fail rate is at 0.0 (and assuming I have a problem) that should be greater than zero.

wh.png

Their needs to be more tools to understand the problem. If you say 99% of the time it's user error and shopify is sending the request, can I not see a log of this somewhere?

 

Regards,

 

 

0 Likes
HunkyBill
Shopify Expert
4509 46 492

My best advice to you is to reach out to your community then. Not sure what scripting language you are using, but it has users that have handled webhooks before, and probably have written blog posts and Stackoverflow stories about your issue. Try them for advice!

As you well know, Webhooks are nothing new or exotic in Internet computing, and Shopify is nothing but standard issue Webhooks. So like all things scripting, I am sure there something in your setup you are missing, and once you find it, you'll have glory!

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
TezWingfield83
Tourist
14 0 1

Hi Bill,

Thanks for the reply.

Yes, I've built a few systems on webhooks, they truly are magnificent.

I'm using .net/c#.

Do we not have access to logs? I could scout around, but if the logs just tells me the exact problem, I can resolve it. I have a tracer running this end, and nothing is coming in.

My last attempt is to remove the method from the app and add it to a serverless pipeline (Azure HTTP func), if that fails, well I'm truly lost. I recently wrote an app for a WMS system using hooks, with the same process/method and that works fine.

 

I guess I'll report back.

 

Regards,

0 Likes
HunkyBill
Shopify Expert
4509 46 492

The puzzle from your Dashboard report is fact none are even reported as being tried. So lets type this out. You install your App, which is all fine and dandy. You mastered oAuth. Your database has a token from a shop (likely your test shop) which you setup in the partner Dashboard with ngrok.io settings directly to your App. I myself use a service allowing me to call me Apps stuff like fizzbuzz.test which map nicely to fizzbuzz.ngrok.io which I setup in my Shopify App dashboard.

Once I am setup, and I navigate to the App and see it come up, usually embedded, and usually Polaris... my Hello World if you will, I then uninstall the App. Shopify fires off the uninstall, I watch my terminal logs where I am running my localhost webserver version of the App, and BOOM. I see the Webhook get processed in real-time.

So simple. But the fact that you are doing ALL that, and seeing nothing, is indeed weird. I cannot speak for C# users, but perhaps someone in that community can get you over the hump.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes