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

Error doesn't include explanatory code when requesting upload session

New post

Comments

4 comments

  • jcleblanc

    Hi ,

     

    Thanks for highlighting that the endpoint isn't sending back errors that conform to the standards being used within the other endpoints. We'll take that internally and look into it.

     

    The issue could be that the file size is probably under 20mb (as outlined in the restrictions here). In the errors that should be returned under this scenario, that type of error should come back as a 400 error with the description of file_size_too_small: file_size is below minimum file size for uploads via this API. If that's the cause then there might not be something working correctly. We'll have to dig into that.

     

    - Jon

    0
    Comment actions Permalink
  • davidswalkabout

     After digging further, it seems the failed request is actually never sent, but instead is a failure in the NodeJs Axios library because it seems not to support POST or PUT with a body that's a byte array. See https://github.com/axios/axios/issues/1250#issuecomment-582657318

    I'm now looking into Box's Node SDK, but the sample for uploading a part includes a part_id without any explanation of how to get a part ID.

    0
    Comment actions Permalink
  • jcleblanc

    Hi ,

     

    Good catch on the axios issue. For the chunked uploader use in the Node SDK, check out this guide. It'll walk you through the entire process with the Node code samples and explain what everything is.

     

    - Jon

    0
    Comment actions Permalink
  • davidswalkabout

    Hi  

    A few questions:

    1) https://developer.box.com/en/reference/post-files-content/ says "For file sizes over 50MB we recommend using the Chunk Upload APIs." while you pointed me to https://developer.box.com/en/guides/uploads/chunked/ which says "The Chunked Upload API is intended for large files with a minimum size of 20MB." Should my magic number be 20 or 50 MB?

    2) I asked about there being no explanation of how one gets a "part_id" to upload a part. You pointed me to https://developer.box.com/en/guides/uploads/chunked/ which links to https://developer.box.com/en/guides/uploads/chunked/upload-part/ and the Node tab there for a sample request includes "part_id" but nowhere else does it explain how to get one so it can be included in the request.

    3) I'm considering switching from your REST API to your Node SDK, so I looked at https://developer.box.com/en/guides/uploads/chunked/with-sdks/ The example involves a stream read from a file, but what I need to upload is a byte array representing the file contents. Can you point me to any sample uses of the Node SDK for uploading a byte array (aka buffer)?

    Thanks for your rapid and detailed responses!

    0
    Comment actions Permalink

Please sign in to leave a comment.