Code Monkey home page Code Monkey logo

coconutjs's People

Stargazers

 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

coconutjs's Issues

Getting job details or metadata for an invalid ID causes unhandled error

Methods:

coconut.Metadata.retrieve()
coconut.Job.retrieve()

When using an unknown/invalid job ID causes the following error.

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at IncomingMessage.<anonymous> (/node_modules/coconutjs/api.js:35:29)
    at IncomingMessage.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1125:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

I would expect the callback to be invoked with an error and not simply blowup.

"coconutjs": "^3.0.0"

At the moment the only way to stop this is to try/catch which feels wrong since the callback flow should be able handle this. Nothing seems to stop it ๐Ÿ˜ข

Building URL's with path instead of URL or something else causes issues on Windows machines

In api.js you're building the url path using the path library. This is an issue because it was meant for file system paths.

The resulting path on a unix machine is:
https:/api.coconut.co/v2/jobs which kinda works since https.request is smart enough to not have issue with only one / at https.

BUT, on Windows the result is:
https:\\api.coconut.co\\v2\\jobs this doesn't work, https.request sees this invalid url and tries it's best to convert it and it ends up being https://api.coconut.co//v2/jobs. Now the server since it receives this invalid url it responds with 400 Bad Request.

A good fix would be to use something like the URL object to build the URL or somethign else.

Warning
path is only meant for filesystem paths.

Request Errors do not return error, just null

Hi, in line 48, on the req.on('error') function handler. Could you please return an error?

    req.on('error', function(e) {
      console.log('problem with request: ' + e.message);
      if(callback) {
        callback(null);
      }
    });

This could return callback(e, null) or an object Job with the error code and messages like {status: 'error', error_code: e.code, error_message: e.message}

That way the code in the readme page which has the would always work with a proper return

var coconut = require('coconutjs');

coconut.createJob({
  'api_key': 'k-api-key',
  'conf': 'coconut.conf',
  'source': 'https://s3-eu-west-1.amazonaws.com/files.coconut.co/test.mp4',
  'vars': {'vid': 1234}
}, function(job) {
  if(job.status == 'ok') {
    console.log(job.id);
  } else {
    console.log(job.error_code);
    console.log(job.error_message);
  }
});

Thanking you in advance

I get a TypeErrorCannot read property 'request' of undefined error and cannot upload.

I get the following error.
Is there a solution?

TypeErrorCannot read property 'request' of undefined
at null.null (/opt/ee/node_modules/coconutjs/job.js:15:28)
at null.Promise (null:null:null)
at Function.create (/opt/ee/node_modules/coconutjs/job.js:14:14)
at Object.module.exports (/steps/nodejs.js:23:34)
at MessagePort.messageHandler (/opt/nodejs/node_modules/@pipedreamhq/execution-environment/launch_worker.js:427:41)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:354:41)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)

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.