title: file writing function working on localhost but not on azure
body: <p>I have a function in my node js app that takes information and creates a csv file, then uploads it to the server. The code is below:</p>
  <pre><code>
      //check user has enough credits
      if (req.user.credits &gt;= 5) {
  
          //check if user selected a recipient, and handle
          let { name, address, state, country, city, postcode, message, note_name } = &quot;&quot;;
          let createRecipient = true;
          if (req.body.recipient != &quot;none&quot;) {
              createRecipient = false
  
              const recipient = await userController.getRecipientById(req.body.recipient);
  
              name = recipient.name
              address = recipient.address
              state = recipient.state
              country = recipient.country
              city = recipient.city
              postcode = recipient.postcode
  
              message = req.body.message
              note_name = req.body.note_name
          } else {
             name = req.body.name
             address = req.body.address
             state = req.body.state
             country = req.body.country
             city = req.body.city
             postcode = req.body.postcode
             message = req.body.message
             note_name = req.body.note_name
          }
          const path = 'uploads\\notes_files\\';
          const filename = path + randomUUID() + '.csv';
  
          //first, save recipent to database
          console.log(createRecipient + req.body.save_recipient)
          if (createRecipient &amp;&amp; req.body.save_recipient == 'on') {
              db.query('INSERT into RECIPIENTS SET ?', {user_id: req.user.id, name: name, address: address, state: state, country: country, city: city, postcode: postcode }, function(err) {
                  if (err) throw err
              });
          }
  
          //next, create a CSV file
          const csvWriter = createCsvWriter({
              path: filename,
              header: [
                  {id: 'name', title: 'Name'},
                  {id: 'address', title: 'Address'},
                  {id: 'state', title: 'State'},
                  {id: 'country', title: 'Country'},
                  {id: 'city', title: 'City'},
                  {id: 'postcode', title: 'Postcode'},
                  {id: 'message', title: 'Message'}
              ]
          });
  
          const records = [
              {name: name, address: address, state: state, country: country, city: city, postcode: postcode, message: message}
          ];
  
          await csvWriter.writeRecords(records)
              .then(() =&gt; {
  
                  let note_id;
                  db.query(`INSERT INTO notes SET ?`, {filename: 'temp', user_id: req.user.id, note_status: 'pending', note_name: note_name }, function(err, result) {
                      if (err) throw err;
                      
                      // rename file to format 'note*id*_user*id*
                      note_id = result.insertId
                      const new_filename = 'note' + note_id + '_user' + req.user.id + '.csv'
  
                      //update in DB
                      db.query('UPDATE notes SET filename = ? WHERE note_id = ?', [ new_filename, note_id ], function(err) {
                          if (err) throw err;
  
                          //move to uploads folder
                          fs.rename(filename, path + new_filename, function(err) {
                              if (err) {
                                  console.log(err);
                                  res.send('There was a problem uploading your file. Please try again.');
                              }
  
                              //create notification before ending function
                              userController.createNotification(req.user.id, &quot;New Note&quot;, &quot;New note has been sent to our team for approval.&quot;);
                                                  
                              res.redirect('/');
                          });
                      });
                  });
              })
      } else {
          res.status(400).send('Not enough credits.')
      }
  }
  </code></pre>
  <p>this works fine on localhost, but when i deploy the app on an azure web app, i get this error in the azure logs:</p>
  <pre><code>2022-06-07T06:33:57.961918438Z node:internal/process/promises:246
  2022-06-07T06:33:57.961969838Z           triggerUncaughtException(err, true /* fromPromise */);
  2022-06-07T06:33:57.961997638Z           ^
  2022-06-07T06:33:57.962012639Z
  2022-06-07T06:33:57.962016639Z [Error: EINVAL: invalid argument, open 'uploads\notes_files\1d624787-2d06-41d7-909e-bb6283ea0efb.csv'] {
  2022-06-07T06:33:57.962020839Z   errno: -22,
  2022-06-07T06:33:57.962024839Z   code: 'EINVAL',
  2022-06-07T06:33:57.962028639Z   syscall: 'open',
  2022-06-07T06:33:57.962102239Z   path: 'uploads\\notes_files\\1d624787-2d06-41d7-909e-bb6283ea0efb.csv'
  2022-06-07T06:33:57.962110639Z }
  </code></pre>
  <p>Any clue as to why this is working on localhost but not on azure?</p>