Giter Site home page Giter Site logo

Comments (8)

cbetta avatar cbetta commented on July 30, 2024

@leggetter as I don't have a shortnumber, can you run with --debug and post the API result?

from nexmo-cli.

cbetta avatar cbetta commented on July 30, 2024

Also does the API support this?

from nexmo-cli.

leggetter avatar leggetter commented on July 30, 2024
› nexmo insight:standard NUMBER --debug
This operation will charge your account.

Please type "confirm" to continue: confirm

{ host: 'api.nexmo.com',
  port: 443,
  path: '/number/lookup/json?number=NUMBER&api_key=KEY&api_secret=SECRET',
  method: 'GET',
  headers:
   { 'Content-Type': 'application/x-www-form-urlencoded',
     accept: 'application/json' } }
response ended
Validator.response() - Error:
null
Validator.response() - Response:
{ status: 3,
  status_message: 'Invalid request :: Not valid number format detected [ 45************ ]' }
End Validator.response()
/usr/local/lib/node_modules/nexmo-cli/distribution/response.js:185
      this.emitter.list(response.international_format_number + ' | ' + response.country_code + ' | ' + response.current_carrier.name, response);
                                                                                                                               ^

TypeError: Cannot read property 'name' of undefined
    at Response.insightStandard (/usr/local/lib/node_modules/nexmo-cli/distribution/response.js:185:128)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/nexmo-cli/node_modules/easynexmo/lib/nexmo.js:257:19)
    at emitNone (events.js:85:20)
    at IncomingMessage.emit (events.js:179:7)
    at endReadableNT (_stream_readable.js:913:12)
    at _combinedTickCallback (node.js:377:13)
    at process._tickCallback (node.js:401:11)

@cbetta - Will DM you the number.

from nexmo-cli.

cbetta avatar cbetta commented on July 30, 2024

@leggetter the number is in the debug...

from nexmo-cli.

sammachin avatar sammachin commented on July 30, 2024

@leggetter Were you trying to run number insight against an SMS shortcode? (eg 89101) These type of numbers are country and sometimes even carrier specific so aren't really 'phone numbers' in the sense of the e.164 numbering plan.
Number Insight only works against e.164 numbers that you can dial/sms from ANY phone.

Also FYI LVN's are a term for the e.164 numbers that Nexmo sells for Voice and or SMS

from nexmo-cli.

leggetter avatar leggetter commented on July 30, 2024
{ status: 3,
  status_message: 'Invalid request :: Not valid number format detected [ NUMBER ]' }

It wasn't a short code.
456***********

from nexmo-cli.

sammachin avatar sammachin commented on July 30, 2024

Ok this looks to be a bug with the nexmo-node library when making a request for an invalid number to the insight standard API it works when requesting insight basic (although exposing the error could be better)

BASIC:

{ host: 'api.nexmo.com',
  port: 443,
  path: '/number/format/json?number=441233444341324&api_key=XXX&api_secret=XXX',
  method: 'GET',
  headers: 
   { 'Content-Type': 'application/x-www-form-urlencoded',
     accept: 'application/json' } }
response ended
Validator.response() - Error: 
null
Validator.response() - Response: 
{ status: 3,
  status_message: 'Invalid request :: Not valid number format detected [ 441233444341324 ]' }

STANDARD:

{ host: 'api.nexmo.com',
  port: 443,
  path: '/number/lookup/json?number=441233444341324&api_key=XXX&api_secret=XXX',
  method: 'GET',
  headers: 
   { 'Content-Type': 'application/x-www-form-urlencoded',
     accept: 'application/json' } }
response ended
Validator.response() - Error: 
null
Validator.response() - Response: 
{ status: 3,
  status_message: 'Invalid request :: Not valid number format detected [ 441233444341324 ]' }
End Validator.response()
/usr/local/lib/node_modules/nexmo-cli/distribution/response.js:185
      this.emitter.list(response.international_format_number + ' | ' + response.country_code + ' | ' + response.current_carrier.name, response);
                                                                                                                               ^

TypeError: Cannot read property 'name' of undefined
    at Response.insightStandard (/usr/local/lib/node_modules/nexmo-cli/distribution/response.js:185:128)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/nexmo-cli/node_modules/easynexmo/lib/nexmo.js:257:19)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:913:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

from nexmo-cli.

sammachin avatar sammachin commented on July 30, 2024

So having discussed this with @cbetta its not a nexmo-node issue its the CLI not handling the error nicely, so this needs to be fixed in the CLI.

If it seens a status other than 0 returned it should print the contents of the status_message to the screen, this should work in both normal and verbose modes

from nexmo-cli.

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.