Getting 403 forbidden when Uploading file to DO spaces using Node + Express


I am trying to upload file to DO s3 space using Node + Express.
But I am getting 403 forbidden issue.

Following is my uploading source code.

const aws = require('aws-sdk')
const multer = require('multer')
const multerS3 = require('multer-s3')

const space_ep = new aws.Endpoint('')
const s3 = new aws.S3({
    endpoint: space_ep,
    accessKeyId: 'my-access-key',
    secretAccessKey: 'my-secret-access-key'

const uploader = multer({
    storage: multerS3({
        s3: s3,
        bucket: 'my-bucket',
        acl: 'public-read',
        key: function(request, file, cb) {
            cb(null, file.originalname)
}).array('upload', 1)

export function upload(req, res, next) {
    uploader(req, res, function(error) {
        if (error) {
            return res.redirect('/error')
        console.log('upload success')


let router = require('express').Router()'/upload', upload)

And when I try to upload, I am getting error in console as following

{ UserSuspended: null
    at Request.extractError (path\node_modules\aws-sdk\lib\services\s3.js:831:35)
    at Request.callListeners (path\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
    at Request.emit (path\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
    at Request.emit (path\node_modules\aws-sdk\lib\request.js:683:14)
    at Request.transition (path\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (path\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at path\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (path\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (path\node_modules\aws-sdk\lib\request.js:685:12)
    at Request.callListeners (path\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
  message: null,
  code: 'UserSuspended',
  region: null,
  time: 2020-05-30T07:00:19.383Z,
  requestId: 'tx000000000000011987442-005ed20482-21a2fa-nyc3b',
  extendedRequestId: undefined,
  cfId: undefined,
  statusCode: 403,
  retryable: false,
  retryDelay: 17.163587715908,
  storageErrors: [] }

How can I fix this issue?

What’s the reason?

Please help me.



OK. I solved it.

My source code was not problem.

I contacted to DO support team, and they solved their issue and told me try again.

After that I success.

Answered By – WebDev

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published