TheThingsArchive / node-app-sdk

The Things Network Application SDK for Node.JS
https://www.thethingsnetwork.org/docs/node-js/
MIT License
41 stars 28 forks source link

application manager relies on nonexistent HTTPS endpoint #59

Closed noerw closed 7 years ago

noerw commented 7 years ago

Currently, the HTTPS endpoint for the application manager API does not exist; to cite the docs:

A secure endpoint at https will follow soon.

this results in errors when trying to make requests:

{ FetchError: request to https://us-west.thethings.network:8084/applications/opensensemap-test failed, reason: write EPROTO 140413053495104:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:

    at ClientRequest.<anonymous> (/home/kreis/senseBox/repos/ttn-osem-application/node_modules/node-fetch/index.js:133:11)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:309:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at onwriteError (_stream_writable.js:343:10)
    at onwrite (_stream_writable.js:361:5)
    at WritableState.onwrite (_stream_writable.js:90:5)
    at fireErrorCallbacks (net.js:467:13)
    at TLSSocket.Socket._destroy (net.js:508:3)
    at WriteWrap.afterWrite (net.js:802:10)
  name: 'FetchError',
  message: 'request to https://us-west.thethings.network:8084/applications/asdfasdf-test failed, reason: write EPROTO 140413053495104:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:\n',
  type: 'system',
  errno: 'EPROTO',
  code: 'EPROTO' }

Don't know if this should be fixed, as keys should not be exchanged via HTTP anyway. Opening the issue anyway for others to see, as it took me some time to find out the cause.

johanstokking commented 7 years ago

Thanks for reporting @noerw. This is definitely something we need to support.

johanstokking commented 7 years ago

We're going to close HTTP at all and switch to gRPC

mirk8xr commented 7 years ago

@johanstokking Where I can find an example(or the docs) of gRPC node client that access to the application manager api? How authentication works?

noerw commented 7 years ago

Is support for gRPC in this node-app-sdk planned? when will it land?

johanstokking commented 7 years ago

@mirk8xr @noerw it's not out yet, but @romeovs will work on this. Please watch #54. I'm closing this issue because we're discontinuing HTTP on the Handler

jpmeijers commented 7 years ago

Damn. This means I have to change the TTN Mapper app to use gRPC too. Which is a hassle, because autogenerating java code from protobufs in Android studio doesn't work well.