Code Monkey home page Code Monkey logo

algorithmia-nodejs's People

Contributors

acanedo avatar anaimi avatar anowell avatar archr avatar daleherring avatar dependabot[bot] avatar jamesatha avatar kennydaniel avatar platypii avatar pmcq 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

Watchers

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

algorithmia-nodejs's Issues

CORS issue when call algo nodejs api from ionic(angular) app (response for preflight has invalid HTTP 404) )

I am trying to make a mobile app with ionic3( based on angular4). it could also be a progressive web app (PWA). When call algo node api, I get following CORS error,

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. The response had HTTP status code 404.

ReferenceError: headers is not defined in algorithmia/lib/data.js

While doing the algorithm DeepFilter

var client = algorithmia(process.env.ALGORITHMIA_API_KEY);
var input={ images: [ 'https://en.wikipedia.org/wiki/Nikola_Tesla#/media/File:N.Tesla.JPG' ],
  savePaths: [ 'data://.my/DeepFilterTest/stylized_image.jpg' ],
  filterName: 'space_pizza' }
client.dir('data://.my/DeepFilterTest/').create((res)=>console.log(res))

I get

ReferenceError: headers is not defined
    at Dir.create (/myProject/node_modules/algorithmia/lib/data.js:135:100)
    at repl:1:32
    at sigintHandlersWrap (vm.js:32:31)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInContext (vm.js:31:12)
    at REPLServer.defaultEval (repl.js:308:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:489:10)
    at emitOne (events.js:101:20)

TypeError

No matter what algorithm I try to call from a nodejs app, I get the following TypeError.

error:

/XXXX/XXXXX/node_modules/algorithmia/lib/algorithmia.js:75
        if (ct.startsWith('application/json')) {
               ^
TypeError: undefined is not a function
    at IncomingMessage.<anonymous> (/XXXX/XXXXX/node_modules/algorithmia/lib/algorithmia.js:75:16)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)

call:

var algorithmia = require("algorithmia");
var client = algorithmia('API KEY');

client.algo("algo://demo/Hello/0.1.1")
    .pipe("HAL 9000")
    .then(function(response) {
    console.log(response.get());
    });

Have tried rotating API keys, spinning up a fresh node app, and trying a bunch of different algorithms, but no dice.

Use a promise library

Results with a .then are generally thought to be promises. The issue here is that the result isn't a real promise and doesn't conform the promises A+ spec.

This becomes a problem for example if you want to handle an exception you might assume that you can attach a .catch() to the result.

Missing binary support for Data API

File has putString, putJson, getString and getJson methods, but no way to work with binary files. (The algorithm pipe method does support binary input/output)

IMO, we should add put that works with strings and byte Buffers like most other clients. I think putString and putJson should be deprecated in a future release. putString becomes redundant of put, and putJson is more confusing than helpful (if it takes JSON input, it's redundant of putString, if it takes an object, it's the opposite of the pipeJson method). In all cases, put(JSON.stringify(myobject)) is simple and obvious.

We could have separate getString and getBytes, but I'm inclined to push for future deprecation of those behind a get and probably getFile.

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.