Giter Site home page Giter Site logo

digitalocean-node's People

Contributors

brostafa avatar cheesetouched avatar milekz avatar omgimanerd avatar phillbaker avatar steadweb avatar straley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

digitalocean-node's Issues

Lazy pagination of index lists

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.

Listing Droplets fail

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
            });
        }

    });`

Throttle requests

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.

Random Password Generated for Ubuntu Deployments with SSH Keys

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:

  • Create a new droplet with an Ubuntu image and provide valid SSH key IDs from D.O.
  • Try to root into the droplet, you will be prompted to enter the current password for root.

TypeScript types

Started using digitalocean module in TypeScript environment. It would be nice if the module came with built-in types.

Pagination promise example error

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

unable to client.droplets.deleteByTag

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.

Wrong response code

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);

Error: Unexpected reponse code: 200

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

Renaming a tag doesn't return the new tag's JSON

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

Use with await

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.