概括我一直在關注關于使用 Node 和 React 設置應用程序的 Shopify 教程。我一切正常,但我正試圖越過最后一步。我正在嘗試獲取從 Shopify webhooks 返回的數據,但我看不到數據/有效負載的位置。背景我已經嘗試在中間件之前和之后打印出響應和請求,但似乎沒有得到任何有用的回報,只是收到如下內容:{ method: 'POST', url: '/webhooks/products/create', header: { host: '01e9702c.ngrok.io', 'user-agent': 'Shopify-Captain-Hook', 'content-length': '1175', accept: '*/*', 'accept-encoding': 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'content-type': 'application/json', 'x-shopify-api-version': '2019-07', 'x-shopify-hmac-sha256': 'some value', 'x-shopify-product-id': '2018829729858', 'x-shopify-shop-domain': 'example.myshopify.com', 'x-shopify-topic': 'products/create', connection: 'close', 'x-forwarded-proto': 'https', 'x-forwarded-for': '123.456.789' } } router.post('/webhooks/products/create', webhook, (ctx) => { console.log('Products webhook - create: ', ctx.state.webhook); // Want to view product that was created here }); router.post('/webhooks/products/delete', webhook, (ctx, x) => { console.log('Products webhook - delete: ', ctx.state.webhook); // Want to see product that was deleted here });
無法從 Shopify Webhook 中找到數據/有效負載
胡說叔叔
2021-09-30 15:02:47