第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法從 Shopify Webhook 中找到數(shù)據(jù)/有效負(fù)載

無法從 Shopify Webhook 中找到數(shù)據(jù)/有效負(fù)載

胡說叔叔 2021-09-30 15:02:47
概括我一直在關(guān)注關(guān)于使用 Node 和 React 設(shè)置應(yīng)用程序的 Shopify 教程。我一切正常,但我正試圖越過最后一步。我正在嘗試獲取從 Shopify webhooks 返回的數(shù)據(jù),但我看不到數(shù)據(jù)/有效負(fù)載的位置。背景我已經(jīng)嘗試在中間件之前和之后打印出響應(yīng)和請求,但似乎沒有得到任何有用的回報,只是收到如下內(nèi)容:{ 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  });
查看完整描述

2 回答

?
慕標(biāo)琳琳

TA貢獻1830條經(jīng)驗 獲得超9個贊

你使用的網(wǎng)絡(luò)框架是什么?是快遞嗎?添加 webhook 的代碼會有所幫助,但現(xiàn)在您的簽名已關(guān)閉。


請在此處查看我的回答Nodejs - Expressjs - 驗證 shopify webhook以了解如何使用正文解析器的驗證方法。


然后你的鉤子處理程序看起來像:


router.post('/webhooks/products/create', (req, res)=>{

    console.log(JSON.stringify(req.body, null, ' '));

    res.sendStatus(200);

    // process the webhook

});


查看完整回答
反對 回復(fù) 2021-09-30
?
德瑪西亞99

TA貢獻1770條經(jīng)驗 獲得超3個贊

看起來您正在使用基本節(jié)點/反應(yīng)示例中的 Koa 框架。

假設(shè)您已經(jīng)找到它,但是任何人都在尋找,答案是ctx.state.webhook.payload
您可以從那里訪問各個元素,因此 ctx.state.webhook.payload.title也可以使用。


查看完整回答
反對 回復(fù) 2021-09-30
  • 2 回答
  • 0 關(guān)注
  • 354 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號