2

我正在为我的 Shopify 应用设置应用卸载 webhook。我在 Shopify Developer 中的应用设置为最新的 API (2021-01)。

但是,当我注册我的 webhook 时,没有 ApiVersion.January21 选项。当我将其设置为 January21 时,我得到以下信息:

错误:https://test-sonder.myshopify.com/admin/api/undefined/graphql.json 处的 JSON 响应正文无效 原因:JSON 输入意外结束。

这是我的 server.js

 const { ApiVersion } = require('@shopify/koa-shopify-graphql-proxy');
 const registration = await registerWebhook({
          address: `${HOST}/webhooks/apps/uninstall`,
          topic: 'APP_UNINSTALLED',
          accessToken,
          shop,
          apiVersion: ApiVersion.January21
        });

我的 package.json

  {
  "dependencies": {
    "@koa/router": "^10.0.0",
    "@shopify/app-bridge-react": "^1.28.0",
    "@shopify/koa-shopify-auth": "^3.2.0",
    "@shopify/koa-shopify-graphql-proxy": "^4.1.0",
    "@shopify/koa-shopify-webhooks": "^2.6.0",
    "@shopify/polaris": "^5.12.0",
    "@zeit/next-css": "^1.0.1",
    "apollo-boost": "^0.4.9",
    "axios": "^0.21.1",
    "dotenv": "^8.2.0",
    "graphql": "^15.4.0",
    "isomorphic-fetch": "^3.0.0",
    "koa": "^2.13.1",
    "koa-router": "^8.0.8",
    "koa-session": "^6.1.0",
    "next": "^10.0.4",
    "ngrok": "^3.4.0",
    "react": "16.9.0",
    "react-apollo": "^3.1.5",
    "react-dom": "16.9.0",
    "react-html-parser": "^2.0.2",
    "react-player": "^2.7.2",
    "store-js": "^2.0.4"
  }
}
4

2 回答 2

2

They still have to add it to the package.

You can see the SRC code here https://github.com/Shopify/quilt/blob/master/packages/koa-shopify-graphql-proxy/src/shopify-graphql-proxy.ts and you will noticed that the version is yet not present (as of writing this answer).

You can use the unstable version if you need something for the latest API or switch to the October20 one if you are not looking for something that came recently to the API.

于 2021-01-05T06:51:14.330 回答
0

从 v6.0.0 开始,枚举已更新以包含新版本,而且 TypeScript 类型已更改为更宽松的字符串联合类型以允许任意版本,因此即使库落后,您也可以使用任何版本。

于 2021-09-03T23:04:03.610 回答