spaces - InvalidAccessKeyId

July 18, 2018 147 views
Node.js Ubuntu 16.04

When I try a simple spaces upload using the aws -sdk I keep getting the error: 'InvalidAccessKeyId: null',

here is the code with my secret key redacted:

const AWS = require('aws-sdk');
const fs = require('fs');

const publicKey = 'AKIAIEPGV5ULZ34YOZPA';
const secretKey = 'redacted';

AWS.config.update({region: 'nyc3', accessKeyId: publicKey, secretAccessKey: secretKey});

let spacesEndpoint = new AWS.Endpoint('');
let s3 = new AWS.S3({
endpoint: spacesEndpoint,
region: 'nyc3',
params: {
Bucket: 'packix',
ContentType: 'application/x-debian-package',
ACL: 'private'

let testParams = {
Key: 'packixtestdeb'

let debStream = fs.createReadStream('test.deb');
testParams['Body'] = debStream;

.on('httpUploadProgress', function(evt) { console.log(evt); })
.send(function(err, data) { console.log(err, data) });

Be the first one to answer this question.