You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letclient=require('pkgcloud').storage.createClient({provider: 'amazon',keyId: 'aws-id',// access key idkey: 'aws-key',// secret keyregion: 'us-west-2'// region});// Give list of containersclient.getContainers((err,containers)=>{console.log(err);console.log(containers);});// Throw errorclient.createContainer({name: 'test-name'},function(err,container){console.log(err);console.log(container);});
Error message:
{ TypeError: bucket.indexOf is not a function
at Request.validateBucketName (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\services\s3.js:166:39)
at Request.callListeners (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
at callNextListener (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\sequential_executor.js:95:12)
at c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\event_listeners.js:85:9
at finish (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\config.js:320:7)
at c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\config.js:338:9
at Credentials.get (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\credentials.js:126:7)
at getAsyncCredentials (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\config.js:332:24)
at Config.getCredentials (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\config.js:352:9)
at Request.VALIDATE_CREDENTIALS (c:\ubuntu\klassapp\pkgcloud-test\node_modules\aws-sdk\lib\event_listeners.js:80:26)
message: 'bucket.indexOf is not a function',
code: 'TypeError',
time: 2017-11-15T09:02:47.158Z,
originalError:
{ message: 'Expected params.Bucket to be a string',
code: 'InvalidParameterType',
time: 2017-11-15T09:02:47.157Z } }
// 1 -- to create a container
client.createContainer({
name: 'sample-container-test',
metadata: {
callme: 'maybe'
}
}, function (err, container) {
if (err) {
console.dir(err);
return;
}
method createContainer accepts object not string
If createContainer has different signatures for different providers it should be mentioned in docs or in according example at least.
So issue is still here
After looking at the docs a bit.. passing it in the way you specified should work actually, apologies. I'm going to take a look at this today after work and see whats up. I totally agree with you on the documentation thing.. that needs to be updated.
I'll see about cleaning that up as well, thank you!
So I've dug into the code a bit.. indeed there is a bug. The create container function checks whether or not the options argument is of type storage.Container. The issue is that storage.container is undefined.
All clients should have a standardized way of checking that options parameter. It should be changed to follow the openstack createContainer format. I've tested this change locally and it works as expected.
Openstack createContainer
exports.createContainer = function (options, callback) {
var containerName = typeof options === 'object' ? options.name : options,
self = this;
var createContainerOpts = {
method: 'PUT',
container: containerName
};
if (options.metadata) {
createContainerOpts.headers = self.serializeMetadata(self.CONTAINER_META_PREFIX, options.metadata);
}
this._request(createContainerOpts, function (err) {
return err
? callback(err)
: callback(null, new self.models.Container(self, { name: containerName, metadata: options.metadata }));
});
};
I pulled down the master branch but I cant get it to pass TravisCi(With no changes to the code base). This is 'options' issue is an easy fix and I like to get it out soon but unfortunately this has stalled me.
Any thoughts @rosskukulinski ? Looks like youve fixed these Travis-ci issues in the past.
Its been posted elsewhere but this is what Travis is looking like..
733 passing (9s)
35 pending
2 failing
1) pkgcloud/openstack/storage/ The openstack Storage client copy should copy within the same container:
Uncaught Error: No Match For: POST /v2.0/tokens
at IncomingMessage.<anonymous> (/Users/alexanderlong/Documents/GitHub/pkgcloud/node_modules/hock/lib/hock.js:364:15)
at IncomingMessage.emit (events.js:182:13)
at endReadableNT (_stream_readable.js:1081:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
2) pkgcloud/openstack/storage/ The openstack Storage client copy "after each" hook:
Error: timeout of 4000ms exceeded
at Timeout.<anonymous> (/Users/alexanderlong/Documents/GitHub/pkgcloud/node_modules/mocha/lib/runnable.js:158:19)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
Activity
gustxyz commentedon Jul 22, 2018
Hey there @terbooter. To create a container just pass in the name as a string, not as an object.
gustxyz commentedon Jul 22, 2018
Issue should be closed.
terbooter commentedon Jul 23, 2018
According to this example https://github.com/pkgcloud/pkgcloud/blob/master/examples/storage/rackspace.js
method
createContaineraccepts object not stringIf
createContainerhas different signatures for different providers it should be mentioned in docs or in according example at least.So issue is still here
gustxyz commentedon Aug 3, 2018
After looking at the docs a bit.. passing it in the way you specified should work actually, apologies. I'm going to take a look at this today after work and see whats up. I totally agree with you on the documentation thing.. that needs to be updated.
I'll see about cleaning that up as well, thank you!
gustxyz commentedon Aug 4, 2018
So I've dug into the code a bit.. indeed there is a bug. The create container function checks whether or not the options argument is of type storage.Container. The issue is that storage.container is undefined.
s3 createContainer
All clients should have a standardized way of checking that options parameter. It should be changed to follow the openstack createContainer format. I've tested this change locally and it works as expected.
Openstack createContainer
gustxyz commentedon Aug 4, 2018
I pulled down the master branch but I cant get it to pass TravisCi(With no changes to the code base). This is 'options' issue is an easy fix and I like to get it out soon but unfortunately this has stalled me.
Any thoughts @rosskukulinski ? Looks like youve fixed these Travis-ci issues in the past.
gustxyz commentedon Aug 4, 2018
Its been posted elsewhere but this is what Travis is looking like..