1

使用 cloudflare 实现 Web 挂钩时,我不断收到以下错误消息。

与 Trebble 通信时出错。

开发控制台说:

raven.js:1 Hook failure 
    1. {type: "system", message: "unexpected end of JSON input", fields: Array(0)}
        1. fields:[]
        2. message:"unexpected end of JSON input"
        3. type:"system"
        4. __proto__:Object
raven.js:1 Error(s) triggering preview hook 
    1. [{…}]
    console.(anonymous function)    @   raven.js:1
    (anonymous) @   installs.coffee:53
    processQueue    @   angular.js:13318
    (anonymous) @   angular.js:13334
    $eval   @   angular.js:14570
4

1 回答 1

0

您需要检查来自该端点的响应是不正确的 JSON 格式。您可以对 API 端点运行 curl 以模拟 Cloudflare 的 Web 挂钩。

您可以通过触发钩子来获取 JSON,然后在您的开发工具中查找类似的 URL

curl -vs "http://example.com/wordofday" --data {"event":"preview","install":{"id":"**","versionTag":null,"options":{},"schema":{"properties":{"location":{"title":"Message Location","description":"Where should the message appear?","order":0,"type":"object","format":"element","default":{"selector":"body","method":"prepend"}},"newopt_word":{"title":"Message","description":"A short example message.","type":"string","format":"richtext","order":1,"default":"<p>Welcome to Cloudflare Apps! This is our example app.</p><p>Download this app every time you want to make a new project.</p>"},"message":{"title":"Message","description":"A short example message.","type":"string","format":"richtext","order":1,"default":"<p>Welcome to Cloudflare Apps! This is our example app.</p><p>Download this app every time you want to make a new project.</p>"}}},"siteId":"preview","appId":"local","active":true,"metadata":{"userId":"**"}},"userId":"**"} -H "Accept:application/json, text/plain, */*" -H "content-type: application/json;charset=UTF-8"
于 2018-04-23T22:27:02.160 回答