Shopify:在此地址上没有页面

发布于 2025-02-04 21:11:30 字数 2071 浏览 2 评论 0原文

我在这个问题。但是解决方案对我不起作用。 app_uninstalled webhook的工作原理非常好,我在删除时禁用了访问令牌,还可以从Active Shops列表中删除商店。我正在使用Shopify CLI和Node。

这就是我正在做的:

  • 安装应用程序
  • 删除应用程序
  • 单击“后面”按钮以返回应用程序页面。 URL格式为:https:// [store]/admin/apps/[Random ID]/?shop = [store]& host = [Random Hex]。我还发现这甚至不再击中我的应用程序(即卸载后没有日志)。

我看到一个“这个地址上没有页面”错误。

与Webhooks相对应的代码:

    router.post("/webhooks", async (ctx) => {
    try {
      console.log(
        `Getting called successfully. Context object: ${JSON.stringify(ctx)}`
      );
      let topic = ctx.get('x-shopify-topic')
      if(topic && topic === `app/uninstalled`){
          const shop = ctx.get('x-shopify-shop-domain')
          console.warn(`App uninstalled from shop: ${shop}. Removing shop from active shopify shops list`)
          delete ACTIVE_SHOPIFY_SHOPS[shop]
          console.debug(`App uninstalled from shop: ${shop}. Successfully removed shop from active shopify shops list. Current list is: ${JSON.stringify(ACTIVE_SHOPIFY_SHOPS)}`)
          console.warn(`App uninstalled from shop: ${shop}. Attempting to mark token as disabled...`)
          const record = await getShopToken(shop, true)
          console.debug(`Token record from DB for ${shop}: ${JSON.stringify(record)}`)
          if(record){
            await storeShopToken(record.SHOP, record.ACCESS_TOKEN, record.SCOPE, `DISABLED`)
            console.debug(`Successfully disabled access token for ${shop}.`)
          }else{
            console.warn(`Could not find the current token entry for ${shop}. Unable to mark token as disabled.`)
          }
      }
      await Shopify.Webhooks.Registry.process(ctx.req, ctx.res);
      console.log(`Webhook processed, returned status code 200`);
    } catch (error) {
      console.log(`Failed to process webhook: ${error}`);
    }
  });

这阻止了应用程序获得认证。请指教。

I'm having the exact same issue described in this question. But the solution doesn't work for me. The app_uninstalled webhook works perfectly fine and I'm disabling the access token upon deletion and also removing the store from the active shops list. I'm using Shopify CLI and Node.

This is what I'm doing:

  • Install the app
  • Delete the app
  • Click on the back button to go back to the app page. The URL format is: https://[store]/admin/apps/[random id]/?shop=[store]&host=[random hex]. I also found that this is not even hitting my app anymore (i.e. no logs after the uninstall).

I'm seeing a "There’s no page at this address" error.

Code corresponding to webhooks:

    router.post("/webhooks", async (ctx) => {
    try {
      console.log(
        `Getting called successfully. Context object: ${JSON.stringify(ctx)}`
      );
      let topic = ctx.get('x-shopify-topic')
      if(topic && topic === `app/uninstalled`){
          const shop = ctx.get('x-shopify-shop-domain')
          console.warn(`App uninstalled from shop: ${shop}. Removing shop from active shopify shops list`)
          delete ACTIVE_SHOPIFY_SHOPS[shop]
          console.debug(`App uninstalled from shop: ${shop}. Successfully removed shop from active shopify shops list. Current list is: ${JSON.stringify(ACTIVE_SHOPIFY_SHOPS)}`)
          console.warn(`App uninstalled from shop: ${shop}. Attempting to mark token as disabled...`)
          const record = await getShopToken(shop, true)
          console.debug(`Token record from DB for ${shop}: ${JSON.stringify(record)}`)
          if(record){
            await storeShopToken(record.SHOP, record.ACCESS_TOKEN, record.SCOPE, `DISABLED`)
            console.debug(`Successfully disabled access token for ${shop}.`)
          }else{
            console.warn(`Could not find the current token entry for ${shop}. Unable to mark token as disabled.`)
          }
      }
      await Shopify.Webhooks.Registry.process(ctx.req, ctx.res);
      console.log(`Webhook processed, returned status code 200`);
    } catch (error) {
      console.log(`Failed to process webhook: ${error}`);
    }
  });

This is preventing the app from getting certified. Please advise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疧_╮線 2025-02-11 21:11:30

如果您仅在重新安装的应用程序案例上找到此消息,则需要删除 shop.shopify_token shop.shopify_domain 字段,然后收到UnInStall Webhook。

我所做的是创建一个新的 uninstalled_domain 列,在收到卸载WH之后,将Shop.shopify_domain的值传递给了该新列,然后我删除了Shop.shopify_domain列。

当用户登录时,我检查是否存在uninstalled_domain,如果是,则意味着用户不是新的,而是重新安装。然后,我在数据库中切换到该行,然后删除恰好创建的行。

这样,用户在重新安装后找到了所有数据。

If you are finding this message only on the reinstalling app cases, you need to delete the shop.shopify_token and the shop.shopify_domain fields after you receive the uninstall webhook.

What I did was to create a new uninstalled_domain column, passed the value of shop.shopify_domain to that new column after receiving the uninstall WH and then I deleted the shop.shopify_domain column.

When a user logins, I check if uninstalled_domain exists, if so, it means the user is not new, but reinstalling. Then I switch to that row in the DB and delete the just created row.

That way the user finds all his data after reinstalling.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文