phillbaker / digitalocean-node Goto Github PK
View Code? Open in Web Editor NEWUnofficial node client for the v2 DigitalOcean API
Home Page: http://phillbaker.github.io/digitalocean-node
License: MIT License
Unofficial node client for the v2 DigitalOcean API
Home Page: http://phillbaker.github.io/digitalocean-node
License: MIT License
On volumes.js, line 36 .create:
return this.client.post('/volumes', attributes, 202, 'volume', callback);
which causes an error, needs to be changed to
return this.client.post('/volumes', attributes, 201, 'volume', callback);
Detaching a volume returns a response status code of 202, which is passed as an error through the callback. This is likely because line 148 in volume.js expects a 201.
Encountering an issue when deploying an Ubuntu image + providing valid SSH key IDs from digital ocean where Digital Ocean will set a random password for root, and cannot log into the server without entering the current password and changing it.
Except Digital Ocean will not email a randomly generated password, leaving the droplet inaccessible.
Steps to replicate:
This is missing right now right?
node_modules\digitalocean\lib\digitalocean\client.js:160:25
When attempting to create a volume ( using client.volumes.create( {attrs} ) ) I'm getting the aforementioned error, which is actually a success. I can see the volume is created on DO.
Not sure why I'm getting a 200 response and not a 201 as per the docs, but in any case this should not cause the promise to fail.
Region I'm seeing this issue on is sgp1
Whenever I initiate the method for listing droplets, it hangs.
Here's the code that I'm using:
`
client.droplets.list(function(err, data){
data._digitalOcean.body = {};
if(err){
res.json({
status: 400,
operation: 201,
message: "failure",
data: data
});
} else {
data._digitalOcean.body = {};
res.json({
status: 200,
operation: 200,
message: "Success",
data: data
});
}
});`
Renaming a tag should return the new tag according to the Digital Ocean documentation, but it returns the JSON object of the old tag. I suspect this is an error on their side.
On a completely unrelated note, I've published this: doclt
Hello, i need your module, pls update your code.
Regards
Hi,
I've used this package for years and I love it. Recently, however, it appears that client.droplets.deleteByTag() doesn't work. When I put a debug statement (console.log) in client.js, in _makeRequestWithBody, I can see that it builds this object:
{ uri: 'https://api.digitalocean.com/v2/droplets',
method: 'DELETE',
headers:
{ Authorization:
'Bearer bla bla bla' },
body: '{"tag_name":"GH"}' }
In the DigitalOcean API docs I see:
To delete Droplets by a tag (for example awesome), send a DELETE request to v2/droplets?tag_name=$TAG_NAME.
So, If I understand the DigitalOcean API correctly, I think the tag_name needs to be part of the URI, not part of the body. However, I'm not sure how to correct this.
Thanks.
Hi,
Any support for digital ocean spaces?
Started using digitalocean
module in TypeScript environment. It would be nice if the module came with built-in types.
Hi,
I started to play with node+DO and found issue with one of examples from main doc.
Promise style
generate a bug TypeError: Cannot read properties of undefined (reading 'body')
- droplets
object don't have ._digitalocean.body.links
data path
When my code removes a bunch of droplets at the same time, I get 429 errors like this one:
[DigitalOceanError: Too many requests] {
statusCode: 429,
headers: {
date: 'Wed, 17 Nov 2021 07:30:51 GMT',
'content-type': 'application/json',
'content-length': '60',
connection: 'close',
'ratelimit-limit': '5000',
'ratelimit-remaining': '0',
'ratelimit-reset': '1637130654',
'x-gateway': 'Edge-Gateway',
'x-request-id': 'ac391732-4926-46fc-8394-9cf1a2ea7e0a',
'x-response-from': 'Edge-Gateway',
'cf-cache-status': 'DYNAMIC',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '6af7418f1f4d00a3-AMS'
},
body: { id: 'Too Many Requests', message: 'Too many requests' }
}
Some client libraries like ccxt (a crypto currency exchange client) have built-in throttle queues that adhere to rate limiting, preventing 429 errors. Suggestion to add this to this client library.
Today, DigitalOcean officially launched Spaces, which is object storage. They also provided an API to interface with it. Could you add support for Spaces? Thanks!
Related reading:
Will this be implemented in the future? Would you be open to accepting a pull request with this implemented?
It'd be great to not expose the internals of DO's API pagination. We should return a array-like object that handles the pagination internally.
JS generators and iterators could be used under the hood to power this.
Just a heads up, the listSshKey typo is still in the npmjs documentation page
Could an example be added to the docs of using this library using await/async?
For example:
const createDroplet = async (userData) => {
try {
const result = await digitalOceanClient.droplets.create(userData);
return true
} catch (e) {
console.error(e)
return false
}
}
... would this be correct?
The digitalocean api has snapshot fetching that's separate from image fetching. Will this be implemented?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.