C# / .NET 7:Shopify 卸载 Webhook 返回 null 响应

C# / .NET 7 : Shopify Uninstall Webhook returns null response

提问人:onyaga 提问时间:11/1/2023 最后编辑:marc_sonyaga 更新时间:11/1/2023 访问量:12

问:

我正在构建一个 Shopify 应用程序,但卸载 webhook 未按预期工作

[HttpPost]
public async Task<StatusCodeResult> AppUninstalled([FromQuery] string shop)
{
    // ....
    // .... if user == null, log and returnOk... this is always null but should not be
}

这是我在控制器中的 webhook,也是创建 webhook 的另一个控制器中的 webhook

        await HttpContext.SignInAsyncUser(user);

        //Check if the AppUninstalled webhook already exists
        //Create the AppUninstalled webhook

        var service = new WebhookService(shop, accessToken);
        var topic = "app/uninstalled";
        var existingHooks = await service.ListAsync(new WebhookFilter
        {
            Topic = topic
        });

        if (!existingHooks.Items.Any())
        {
            // Create the AppUninstalled webhook
            await service.CreateAsync(new Webhook
            {
                Address = _appUrls.AppUninstalledWebhookUrl,
                Topic = topic
            });
        }

这是使用 shopify sharps 文档,我不知道为什么,但 shop 是 null,shopDomain 也是如此,我应该从我的 get 标头请求中得到它。我还将他们的示例应用程序与 ngroc 一起使用,他们的应用程序在我的商店中遇到了同样的问题,不确定这是设置问题还是过时的方法,因为 shopify 喜欢每 5-6 个月更换一次

我的控制台显示我使用 POST /webhooks/appuninstalled 触发了 webhook,但没有 200 OK,并且请求完全为空。我也是初学者,所以我可能解释得很糟糕,但请让它滑:)

我确实尝试将应用程序版本从最新版本更改为 shopifys 最旧的版本 2023-01,但没有改变任何东西。

.NET C#-4.0 webhooks shopify-app

评论


答: 暂无答案