1

我正在尝试使用后续事件从 webhook 代码中触发意图。

 const event_trigger = {
        followupEventInput: {
          name: "event_name",
          languageCode: "en-US"
        }
      };
      return response.json(event_trigger);

我在控制台中收到此错误:

Error: Can't set headers after they are sent.
at validateHeader (_http_outgoing.js:491:11)
at ServerResponse.setHeader (_http_outgoing.js:498:3)
at ServerResponse.header (/worker/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/worker/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/worker/node_modules/express/lib/response.js:267:15)
at V2Agent.sendJson_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:226:26)
at V2Agent.sendMessagesResponse_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:205:10)
at WebhookClient.send_ (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:486:19)
at promise.then (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:306:38)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)

返回 response.json() 方法不是最好的方法吗?什么会起作用?

4

0 回答 0