title: how to send the stack error in a file in a form data discord webhook
body: <p>i have a function with winston_transport and axios
  and i want to send discord web hook message with axios in content type multipart/form-data</p>
  <p>on the webhook discord documentation it says to put payload_json which I did but I got a 400 error return and I don't see why</p>
  <p>i have a function with winston_transport and axios
  and i want to send discord web hook message with axios in content type multipart/form-data</p>
  <p>on the webhook discord documentation it says to put payload_json which I did but I got a 400 error return and I don't see why</p>
  <p>here is my form data that I send with error request 400</p>
  <pre><code>FormData {
    _overheadLength: 111,
    _valueLength: 818,
    _valuesToMeasure: [],
    writable: false,
    readable: true,
    dataSize: 0,
    maxDataSize: 2097152,
    pauseStreams: true,
    _released: false,
    _streams: [
      '----------------------------579151143396808387072667\r\n' +
        'Content-Disposition: form-data; name=&quot;payload_json&quot;\r\n' +
        '\r\n',
      '{&quot;content&quot;:&quot;Red Alert !!! - 17 April 2022 10:22:15&quot;,&quot;username&quot;:&quot;Skynet&quot;,&quot;attachments&quot;:[],&quot;embeds&quot;:[{&quot;title&quot;:&quot;:face_with_symbols_over_mouth: - Hello !&quot;,&quot;description&quot;:&quot;\\&quot;Error: toto\\\\n    at discord (file:///home/lidian/directory_Project/react-simple/api/src/controllers/DiscordLogger.js:37:85)\\\\n    at Layer.handle [as handle_request] (/home/lidian/directory_Project/react-simple/api/node_modules/express/lib/router/layer.js:95:5)\\\\n    at next (/home/lidian/directory_Project/react-simple/api/node_modules/express/lib/router/route.js:137:13)\\\\n    at Route.dispatch (/home/lidian/directory_Project/react-simple/api/node_modules/express/lib/router/route.js:112:3)\\\\n    at....&quot;,&quot;color&quot;:&quot;10038562&quot;,&quot;image&quot;:{&quot;url&quot;:&quot;&quot;},&quot;fields&quot;:[{&quot;name&quot;:&quot;Good Luck&quot;,&quot;value&quot;:&quot;:four_leaf_clover:&quot;}],&quot;timestamp&quot;:&quot;2022-04-17T08:22:15.059Z&quot;}]}',
      [Function: bound ]
    ],
    _currentStream: null,
    _insideLoop: false,
    _pendingNext: false,
    _boundary: '--------------------------579151143396808387072667'
  }
  Request failed with status code 400
  </code></pre>
  <pre><code>
      class DiscordWinstonTransport extends Transport {
          constructor(opts) {
              super(opts);
              this.level = opts.level || &quot;info&quot;;
          }
      
          log(info, callback) {
              setImmediate(() =&gt; {
                  let { level, title, message, error } = info;
      
                  let line = &quot;&quot;;
                  if (error.stack.length) {
                      let err = JSON.stringify(error.stack);
                      if (err.length &gt; 500) line = err.substring(0, 500) + &quot;....&quot;;
                  } else {
                      line = &quot;&quot;;
                  }
              
      
                  const msg = {
                      // avatar_url: &quot;https://i.imgur.com/4M34hi2.png&quot;,
                      content: `${levels.content} !!! - ${dateFormat}`,
                      username: &quot;Skynet&quot;,
                      attachments: [],
                      embeds: [
                          {
                              title: `${levels.emoji} - ${title}`,
                              description: line.length &gt; 0 ? line : message,
                              color: levels.color,
                              image: { url: &quot;&quot; },
                              fields: [
                                  // {
                                  //  name: &quot;Error&quot;,
                                  //  value: &quot;error&quot;,
                                  // },
      
                                  {
                                      name: &quot;Good Luck&quot;,
                                      value: &quot;:four_leaf_clover:&quot;,
                                  },
                              ],
                              timestamp: date,
                              
                          },
                      ],
                  };
      
                  const formdata = new FormData();
                  formdata.append(&quot;file&quot;, error.stack, &quot;file.txt&quot;);
                  formdata.append(&quot;payload_json&quot;, JSON.stringify(msg));
                  
      
                  console.log(formdata);
      
                  axios({
                      headers: { &quot;content-type&quot;: &quot;multipart/form-data&quot; },
                      // headers: { &quot;content-type&quot;: &quot;application/json&quot; },
                      url: envUrl,
                      method: &quot;POST&quot;,
                      data: formdata,
                  })
                      .then((result) =&gt; {
                          callback(null, true);
                      })
                      .catch((error) =&gt; {
                          console.log(error.message);
                      });
              });
      
      
              callback(null, true);
          }
      }
      export { DiscordWinstonTransport };
  
  </code></pre>