Git Product home page Git Product logo

Comments (1)

trentm avatar trentm commented on May 23, 2024

This is because the restify JsonClient isn't very practical when the endpoint happens to not return JSON. I've a better (at least for this) JSON client borrowed heavily from https://github.com/joyent/node-docker-registry-client/blob/v2/lib/docker-json-client.js that should help here.

After:

    ...
    [2015-09-23T19:16:19.485Z] TRACE: triton/39188 on danger0.local (/Users/trentm/joy/node-triton/lib/xxx-json-client.js:130 in finish): Invalid JSON in response
        SyntaxError: Unexpected token <
            at Object.parse (native)
            at IncomingMessage.finish (/Users/trentm/joy/node-triton/lib/xxx-json-client.js:128:32)
            at IncomingMessage.g (events.js:180:16)
            at IncomingMessage.emit (events.js:117:20)
            at _stream_readable.js:944:16
            at process._tickCallback (node.js:448:13)
    triton imgs: error: InvalidContentError: <!DOCTYPE html>
    ...(all the HTML content elided)...
      </body>
    </html>

        at IncomingMessage.finish (/Users/trentm/joy/node-triton/lib/xxx-json-client.js:133:34)
        at IncomingMessage.g (events.js:180:16)
        at IncomingMessage.emit (events.js:117:20)
        at _stream_readable.js:944:16
        at process._tickCallback (node.js:448:13)

At least this more clearly shows that it got a non-JSON response. I hope this doesn't cause other issues, given that I'm fully replacing the restify JSON client.

from node-triton.

Related Issues (20)

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.