Skip to main content

I'm seeing a weird error in using box SDK to get a share link for a file.  In my code I upload the file (replacing existing file), and then request a share link to the file.  I get the share link which is valid.  Then a few seconds later I get an exception from the call that had completed of "updateRedirectionMapping is not defined".  It is really weird.  Is there something that I'm doing wrong?  Has anyone seen this error?

 

                    console.log('file uploaded ' + e.dir + e.file)
settings.uploadFile -= 1
settings.getLink += 1
e.boxID = res.entriese0].id
e.data.status = 'getting box share'
settings.client.files.update(e.boxID, {
shared_link: settings.access
}).then(function (file) {
settings.getLink -= 1
console.log('box complete for ' + e.dir + e.file, file, file.shared_link.url)
e.data.status = 'box complete'
e.data.boxLink = file.shared_link.url
settings.totalCompleted += 1
settings.success()
}).catch(function (err) {
console.log('box failed to get link for ' + e.dir + e.file, err)
e.data.status = 'box failed'
settings.getLink -= 1
settings.failure(err)
})

Here is the console log from this:

 

migrateToBox.js:111
Object {type: "file", id: "***number removed for privacy***541", file_version: Object, sequence_id: "6", etag: "6", …}
migrateToBox.js:111
https://app.box.com/s/84zn4w59onu1486vgdsy6ar9adjcjjkl
migrateToBox.js:111
box failed to get link for ./static_content/***email address removed for privacy***/Mobility Tool-Enabled Best Practices for Design & Development - Brown bag Collaboration Session/Additional Files/Presentation.pptx
migrateToBox.js:117
ReferenceError: updateRedirectionMapping is not defined
migrateToBox.js:117

 


 Are you using the Box Node.js SDK?  I checked and there is no usage of `updateRedirectionMapping` anywhere in that SDK's code — are you sure the error isn't coming from some other code in your project?  What does the stack trace for that error say?



I am using the Node SDK ("box-node-sdk": "^1.18.0" from package.json).  The updateRedirectionMapping is a method in my code, but it is not called at this point.  The weird part is was that stepping through the code with only one file, I would see it returning the share link, then about a second later, I would see the catch on the same promise fire and it would be complaining about the updateRedirectionMapping.  I've added code to verify that if I've received a link for a file, then ignore a catch on the same request for the same file.



Reply