All Products
Search
Document Center

Object Storage Service:Initialization code and common errors for uploading and downloading files in Node.js SDK

Last Updated:Feb 25, 2021

Overview

This topic describes the initialization codes and common errors that are returned when you upload or download objects in Node.js SDK.

Detail

Initialize the SDK

The SDK initialization code is as follows:

var oss = require('ali-oss');  var store = oss({   accessKeyId: 'your access key',   accessKeySecret: 'your access secret',   bucket: 'your bucket name',   region: 'oss-cn-hangzhou'
stsToken: 'token'# this parameter is required if you use sts.
secure: true# this parameter is required for https});

Common errors

The following table lists the errors common to SDK upload and download.

ClientError

ClientError is an internal SDK error such as incorrect parameter setting or object modification during resumable Upload Upload or resumable upload and download.

ServerError

ServerError indicates a server error, generated by parsing a server error message. ServerError has the following attributes:
  • status: the HTTP status code of the error request
  • code:OSS error code
  • message:OSS error message.
  • requestId: The UUID that uniquely identifies the request.

Application scope

  • OSS