Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Meteor Sendgrid入站Webhook发送空正文_Meteor_Sendgrid - Fatal编程技术网

Meteor Sendgrid入站Webhook发送空正文

Meteor Sendgrid入站Webhook发送空正文,meteor,sendgrid,Meteor,Sendgrid,尝试按照他们的说明获取Sendgrid的入站解析Webhook 使用流星和铁路由器。我正在捕获请求,但请求正文为空。我正在学习本教程,但是当我执行console.log(this.request.body)时,它返回一个空对象{} 我也尝试过获取文本(this.request.text)、html、from、to、subject,但什么都没有。我唯一成功得到的就是这个.request.headers Sendgrid活动仪表板确实显示电子邮件正在被解析,我显然收到了它们,但正文是空的。这是意外行

尝试按照他们的说明获取Sendgrid的入站解析Webhook

使用流星和铁路由器。我正在捕获请求,但请求正文为空。我正在学习本教程,但是当我执行console.log(this.request.body)时,它返回一个空对象{}

我也尝试过获取文本(this.request.text)、html、from、to、subject,但什么都没有。我唯一成功得到的就是这个.request.headers

Sendgrid活动仪表板确实显示电子邮件正在被解析,我显然收到了它们,但正文是空的。这是意外行为,我不知道如何排除故障。谁能给我指出正确的方向吗?谢谢这是一个示例请求

    { _readableState: 
    { highWaterMark: 16384,
      buffer: [],
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: false,
      ended: false,
      endEmitted: false,
      reading: false,
      calledRead: false,
      sync: true,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      objectMode: false,
      defaultEncoding: 'utf8',
      ranOut: false,
      awaitDrain: 0,
      readingMore: false,
      decoder: null,
      encoding: null },
   readable: true,
   domain: null,
   _events: { close: [Function] },
   _maxListeners: 10,
   socket: 
    { _connecting: false,
      _handle: 
       { fd: 34,
         writeQueueSize: 0,
         owner: [Circular],
         onread: [Function: onread],
         reading: true },
      _readableState: 
       { highWaterMark: 16384,
         buffer: [],
         length: 0,
         pipes: null,
         pipesCount: 0,
         flowing: false,
         ended: false,
         endEmitted: false,
         reading: true,
         calledRead: true,
         sync: false,
         needReadable: true,
         emittedReadable: false,
         readableListening: false,
         objectMode: false,
         defaultEncoding: 'utf8',
         ranOut: false,
         awaitDrain: 0,
         readingMore: false,
         decoder: null,
         encoding: null },
      readable: true,
      domain: null,
      _events: 
       { end: [Object],
         finish: [Function: onSocketFinish],
         _socketEnd: [Function: onSocketEnd],
         drain: [Object],
         timeout: [Function],
         error: [Function],
         close: [Object] },
      _maxListeners: 10,
      _writableState: 
       { highWaterMark: 16384,
         objectMode: false,
         needDrain: false,
         ending: false,
         ended: false,
         finished: false,
         decodeStrings: false,
         defaultEncoding: 'utf8',
         length: 0,
         writing: false,
         sync: true,
         bufferProcessing: false,
         onwrite: [Function],
         writecb: null,
         writelen: 0,
         buffer: [],
         errorEmitted: false },
      writable: true,
      allowHalfOpen: true,
      onend: [Function],
      destroyed: false,
      bytesRead: 8249,
      _bytesDispatched: 0,
      _pendingData: null,
      _pendingEncoding: '',
      server: 
       { domain: null,
         _events: [Object],
         _maxListeners: 10,
         _connections: 1,
         connections: [Getter/Setter],
         _handle: [Object],
         _usingSlaves: false,
         _slaves: [],
         allowHalfOpen: true,
         httpAllowHalfOpen: false,
         timeout: 5000,
         _connectionKey: '4:0.0.0.0:23683' },
      _idleTimeout: 5000,
      _idleNext: 
       { _connecting: false,
         _handle: [Object],
         _readableState: [Object],
         readable: true,
         domain: null,
         _events: [Object],
         _maxListeners: 10,
         _writableState: [Object],
         writable: true,
         allowHalfOpen: false,
         onend: null,
         destroyed: false,
         bytesRead: 79134,
         _bytesDispatched: 14036,
         _pendingData: null,
         _pendingEncoding: '',
         _idleTimeout: 30000,
         _idleNext: [Object],
         _idlePrev: [Circular],
         _idleStart: 1459115857090,
         _monotonicStartTime: 543430569,
         pipe: [Function],
         addListener: [Function: addListener],
         on: [Function: addListener],
         pause: [Function],
         resume: [Function],
         read: [Function],
         _consuming: true },
      _idlePrev: { _idleNext: [Circular], _idlePrev: [Object] },
      _idleStart: 1459115857771,
      _monotonicStartTime: 543431251,
      parser: 
       { _headers: [],
         _url: '',
         onHeaders: [Function: parserOnHeaders],
         onHeadersComplete: [Function: parserOnHeadersComplete],
         onBody: [Function: parserOnBody],
         onMessageComplete: [Function: parserOnMessageComplete],
         socket: [Circular],
         incoming: [Circular],
         maxHeaderPairs: 2000,
         onIncoming: [Function] },
      ondata: [Function],
      _paused: false,
      _httpMessage: 
       { domain: null,
         _events: [Object],
         _maxListeners: 10,
         output: [],
         outputEncodings: [],
         writable: true,
         _last: false,
         chunkedEncoding: false,
         shouldKeepAlive: true,
         useChunkedEncodingByDefault: true,
         sendDate: true,
         _headerSent: false,
         _header: '',
         _hasBody: true,
         _trailer: '',
         finished: false,
         _hangupClose: false,
         socket: [Circular],
         connection: [Circular],
         _headers: [Object],
         _headerNames: [Object],
         write: [Function],
         end: [Function] } },
   connection: 
    { _connecting: false,
      _handle: 
       { fd: 34,
         writeQueueSize: 0,
         owner: [Circular],
         onread: [Function: onread],
         reading: true },
      _readableState: 
       { highWaterMark: 16384,
         buffer: [],
         length: 0,
         pipes: null,
         pipesCount: 0,
         flowing: false,
         ended: false,
         endEmitted: false,
         reading: true,
         calledRead: true,
         sync: false,
         needReadable: true,
         emittedReadable: false,
         readableListening: false,
         objectMode: false,
         defaultEncoding: 'utf8',
         ranOut: false,
         awaitDrain: 0,
         readingMore: false,
         decoder: null,
         encoding: null },
      readable: true,
      domain: null,
      _events: 
       { end: [Object],
         finish: [Function: onSocketFinish],
         _socketEnd: [Function: onSocketEnd],
         drain: [Object],
         timeout: [Function],
         error: [Function],
         close: [Object] },
      _maxListeners: 10,
      _writableState: 
       { highWaterMark: 16384,
         objectMode: false,
         needDrain: false,
         ending: false,
         ended: false,
         finished: false,
         decodeStrings: false,
         defaultEncoding: 'utf8',
         length: 0,
         writing: false,
         sync: true,
         bufferProcessing: false,
         onwrite: [Function],
         writecb: null,
         writelen: 0,
         buffer: [],
         errorEmitted: false },
      writable: true,
      allowHalfOpen: true,
      onend: [Function],
      destroyed: false,
      bytesRead: 8249,
      _bytesDispatched: 0,
      _pendingData: null,
      _pendingEncoding: '',
      server: 
       { domain: null,
         _events: [Object],
         _maxListeners: 10,
         _connections: 1,
         connections: [Getter/Setter],
         _handle: [Object],
         _usingSlaves: false,
         _slaves: [],
         allowHalfOpen: true,
         httpAllowHalfOpen: false,
         timeout: 5000,
         _connectionKey: '4:0.0.0.0:23683' },
      _idleTimeout: 5000,
      _idleNext: 
       { _connecting: false,
         _handle: [Object],
         _readableState: [Object],
         readable: true,
         domain: null,
         _events: [Object],
         _maxListeners: 10,
         _writableState: [Object],
         writable: true,
         allowHalfOpen: false,
         onend: null,
         destroyed: false,
         bytesRead: 79134,
         _bytesDispatched: 14036,
         _pendingData: null,
         _pendingEncoding: '',
         _idleTimeout: 30000,
         _idleNext: [Object],
         _idlePrev: [Circular],
         _idleStart: 1459115857090,
         _monotonicStartTime: 543430569,
         pipe: [Function],
         addListener: [Function: addListener],
         on: [Function: addListener],
         pause: [Function],
         resume: [Function],
         read: [Function],
         _consuming: true },
      _idlePrev: { _idleNext: [Circular], _idlePrev: [Object] },
      _idleStart: 1459115857771,
      _monotonicStartTime: 543431251,
      parser: 
       { _headers: [],
         _url: '',
         onHeaders: [Function: parserOnHeaders],
         onHeadersComplete: [Function: parserOnHeadersComplete],
         onBody: [Function: parserOnBody],
         onMessageComplete: [Function: parserOnMessageComplete],
         socket: [Circular],
         incoming: [Circular],
         maxHeaderPairs: 2000,
         onIncoming: [Function] },
      ondata: [Function],
      _paused: false,
      _httpMessage: 
       { domain: null,
         _events: [Object],
         _maxListeners: 10,
         output: [],
         outputEncodings: [],
         writable: true,
         _last: false,
         chunkedEncoding: false,
         shouldKeepAlive: true,
         useChunkedEncodingByDefault: true,
         sendDate: true,
         _headerSent: false,
         _header: '',
         _hasBody: true,
         _trailer: '',
         finished: false,
         _hangupClose: false,
         socket: [Circular],
         connection: [Circular],
         _headers: [Object],
         _headerNames: [Object],
         write: [Function],
         end: [Function] } },
   httpVersion: '1.1',
   complete: false,
   headers: 
    { 'x-forwarded-proto': 'http',
      'x-forwarded-port': '80',
      'x-forwarded-for': '167.89.125.249,127.0.0.1',
      'content-type': 'multipart/form-data; boundary=xYzZY',
      'content-length': '8782',
      'user-agent': 'SendGrid 1.0',
      host: '6f496891.ngrok.io',
      connection: 'TE, close',
      te: 'deflate,gzip;q=0.3' },
   trailers: {},
   _pendings: [],
   _pendingIndex: 0,
   url: '/webhook/sendgrid',
   method: 'POST',
   statusCode: null,
   client: 
    { _connecting: false,
      _handle: 
       { fd: 34,
         writeQueueSize: 0,
         owner: [Circular],
         onread: [Function: onread],
         reading: true },
      _readableState: 
       { highWaterMark: 16384,
         buffer: [],
         length: 0,
         pipes: null,
         pipesCount: 0,
         flowing: false,
         ended: false,
         endEmitted: false,
         reading: true,
         calledRead: true,
         sync: false,
         needReadable: true,
         emittedReadable: false,
         readableListening: false,
         objectMode: false,
         defaultEncoding: 'utf8',
         ranOut: false,
         awaitDrain: 0,
         readingMore: false,
         decoder: null,
         encoding: null },
      readable: true,
      domain: null,
      _events: 
       { end: [Object],
         finish: [Function: onSocketFinish],
         _socketEnd: [Function: onSocketEnd],
         drain: [Object],
         timeout: [Function],
         error: [Function],
         close: [Object] },
      _maxListeners: 10,
      _writableState: 
       { highWaterMark: 16384,
         objectMode: false,
         needDrain: false,
         ending: false,
         ended: false,
         finished: false,
         decodeStrings: false,
         defaultEncoding: 'utf8',
         length: 0,
         writing: false,
         sync: true,
         bufferProcessing: false,
         onwrite: [Function],
         writecb: null,
         writelen: 0,
         buffer: [],
         errorEmitted: false },
      writable: true,
      allowHalfOpen: true,
      onend: [Function],
      destroyed: false,
      bytesRead: 8249,
      _bytesDispatched: 0,
      _pendingData: null,
      _pendingEncoding: '',
      server: 
       { domain: null,
         _events: [Object],
         _maxListeners: 10,
         _connections: 1,
         connections: [Getter/Setter],
         _handle: [Object],
         _usingSlaves: false,
         _slaves: [],
         allowHalfOpen: true,
         httpAllowHalfOpen: false,
         timeout: 5000,
         _connectionKey: '4:0.0.0.0:23683' },
      _idleTimeout: 5000,
      _idleNext: 
       { _connecting: false,
         _handle: [Object],
         _readableState: [Object],
         readable: true,
         domain: null,
         _events: [Object],
         _maxListeners: 10,
         _writableState: [Object],
         writable: true,
         allowHalfOpen: false,
         onend: null,
         destroyed: false,
         bytesRead: 79134,
         _bytesDispatched: 14036,
         _pendingData: null,
         _pendingEncoding: '',
         _idleTimeout: 30000,
         _idleNext: [Object],
         _idlePrev: [Circular],
         _idleStart: 1459115857090,
         _monotonicStartTime: 543430569,
         pipe: [Function],
         addListener: [Function: addListener],
         on: [Function: addListener],
         pause: [Function],
         resume: [Function],
         read: [Function],
         _consuming: true },
      _idlePrev: { _idleNext: [Circular], _idlePrev: [Object] },
      _idleStart: 1459115857771,
      _monotonicStartTime: 543431251,
      parser: 
       { _headers: [],
         _url: '',
         onHeaders: [Function: parserOnHeaders],
         onHeadersComplete: [Function: parserOnHeadersComplete],
         onBody: [Function: parserOnBody],
         onMessageComplete: [Function: parserOnMessageComplete],
         socket: [Circular],
         incoming: [Circular],
         maxHeaderPairs: 2000,
         onIncoming: [Function] },
      ondata: [Function],
      _paused: false,
      _httpMessage: 
       { domain: null,
         _events: [Object],
         _maxListeners: 10,
         output: [],
         outputEncodings: [],
         writable: true,
         _last: false,
         chunkedEncoding: false,
         shouldKeepAlive: true,
         useChunkedEncodingByDefault: true,
         sendDate: true,
         _headerSent: false,
         _header: '',
         _hasBody: true,
         _trailer: '',
         finished: false,
         _hangupClose: false,
         socket: [Circular],
         connection: [Circular],
         _headers: [Object],
         _headerNames: [Object],
         write: [Function],
         end: [Function] } },
   _consuming: false,
   _dumped: false,
   httpVersionMajor: 1,
   httpVersionMinor: 1,
   upgrade: false,
   originalUrl: '/webhook/sendgrid',
   _parsedUrl: 
    { protocol: null,
      slashes: null,
      auth: null,
      host: null,
      port: null,
      hostname: null,
      hash: null,
      search: null,
      query: null,
      pathname: '/webhook/sendgrid',
      path: '/webhook/sendgrid',
      href: '/webhook/sendgrid' },
   body: {},
 query: {} }

因此,Parse API向您选择的端点发出POST请求,但数据被编码为多部分/表单数据。我建议使用express中间件解析数据,然后通过常规的键值查找来提取数据。下面是一些帮助您解决问题的示例代码:

var form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files){//do something here})

谢谢在您提到数据被编码为多部分/表单数据之前,我不会想到会看到一个不支持它的Iron路由器错误。这是关键。谢谢你的帮助。