Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Comments

8 comments

  • Alex Novotny

    Hey, 

    Are you still having issues? I see this was posted 22 days ago... and just wanted to follow up to see if the issue resolved itself before I dug further. From first glance, the time difference is the only thing that should cause this. 

    1
    Comment actions Permalink
  • Christopher Crawley

    Hi Alex,

    Yes, we are still having this issue... It happens pretty inconsistently, we had our machine team look into it on their end to see if our machines were causing the time difference but they told us that our machines would match the current Unix time so it is unlikely that it is on our end... When we use the box API we are uploading quite a large number of files. Any advice on a fix would be great. Thank you!

    1
    Comment actions Permalink
  • Alex Novotny

    May I have the client id of the application and your enterprise id? 

    0
    Comment actions Permalink
  • Chris Crawley

    Client id: f76v7w6qtdu13hq55uzm089d0ot6yawy

    enterprise id: 149246084

    0
    Comment actions Permalink
  • Alex Novotny

    It looks like that enterprise is a free developer account... do you also have this process running in a paid enterprise account? I'm just curious, because I don't typically see folks running production code in a developer account. 

    Also... is it possible to see the code you are running? 

     

    0
    Comment actions Permalink
  • Chris Crawley

    Yes we have three separate instances, the one I linked was for our dev account, I can get you the production enterprise id if you need.

    Here is a code snippet of our file upload process:

    function readFiles(folderId, client, queryData, countryCode, retryFlag) {
    return new Promise((resolve, reject) => {
      try {
        var dir = normalPath.normalize(path.join(__dirname, "/../fileStorage"));
        var allowIZ = /(\.i6z)$/i;
        fs.readdir(dir, (err, file) => {
          file.forEach(async function (filePath) {
            try {
              console.log(filePath);
              if (allowIZ.exec(filePath)) {
                var stream = fs.createReadStream(normalPath.normalize(path.join(dir, "/" + filePath)));
                let file = await client.files.uploadFile(folderId, filePath, stream)
                let updatedFile = await client.files.update(file.entries[0].id, { shared_link: {} })
                let url = updatedFile.shared_link.download_url;
                resolve(uploadID(updatedFile.id, filePath, queryData.id, url, countryCode));
              }//if
            } catch (e) {
              if (!retryFlag) {
                let retryResponse = await this.readFiles(folderId, client, queryData, countryCode, true);
                resolve(retryResponse);
              } else {
                if (e.statusCode == 500) {
                  resolve('500')
                } else if (e.statusCode == 400 || e.statusCode == 409) {
                  resolve('400')
                } else if (e instanceof ReferenceError) {
                  resolve('refError');
                } else if (e instanceof TypeError) {
                  resolve('typeError');
                }
              }
              reject(e)
            }
          });//forEach
        });//readDir
      } catch (e) {
        if (e.statusCode == 500) {
          resolve(0)
        } else if (e.statusCode == 400) {
          resolve(1)
        }
        reject(e)
      }
    });
    }
    0
    Comment actions Permalink
  • Alex Novotny

    Yes please! It will help me get some support resources if I have the production eid. Thanks!

    0
    Comment actions Permalink
  • Chris Crawley

    prod eid should be 455328

    0
    Comment actions Permalink

Post is closed for comments.