Giter VIP home page Giter VIP logo

Comments (7)

pbombo avatar pbombo commented on August 19, 2024 2

The issue is that your number is not a string and in the format +2547xxxxxxx

@aksalj or @ianjuma :) need to fix the error message for when you have an invalid number format

from africastalking-node.js.

aksalj avatar aksalj commented on August 19, 2024 1

@denzelwamburu Ideally, it should not matter what framework you use. And any node version >= 0.12 should work fine.
Currently (v0.0.2), AfricasTalking.SMS.send() either thows an exception or always returns a promise; so this TypeError: Cannot read property 'then' of undefined should not occur.

from africastalking-node.js.

roboflank avatar roboflank commented on August 19, 2024 1

@aksalj i updated the library to version 0.0.2.
Works fine Now. :)
at

from africastalking-node.js.

aksalj avatar aksalj commented on August 19, 2024

This error (TypeError: Cannot read property then of undefined) should not occur even with the non-string to value because this is checking it and is supposed to throw an exception instead...

@pbombo yeah it should show a clear message instead of just throwing a generic error!

from africastalking-node.js.

roboflank avatar roboflank commented on August 19, 2024

@pbombo Even after using the format +2547xxxxxx, the error still persists

from africastalking-node.js.

aksalj avatar aksalj commented on August 19, 2024

@denzelwamburu what version of the library and node are you using?

Also when I replicate your code above like this

var AfricasTalking = require ('africastalking')({apiKey:null, username: null, format: "json"});
var sms = AfricasTalking.SMS;
var opts = {
    to: 0704654445,
    message: 'Server is Running'
};
console.log(opts);

sms.send(opts)
    .then(function(s) {
        console.log(s);
    })
    .catch(function(error) {
        console.log(error);
    });

here is what I (and should) get

TheWhiteRock:afticastalking aksalj$ node index.js 

/Users/aksalj/src/playground/afticastalking/node_modules/africastalking/lib/index.js:43
        throw error;
        ^
[object Object]
TheWhiteRock:afticastalking aksalj$ 

Like @pbombo said, opts.to needs to be a string like "254704654445" and not a number like 254704654445.

from africastalking-node.js.

roboflank avatar roboflank commented on August 19, 2024

Hey @aksalj am on node v5.4.1 and library v0.0.1
Still using that string format throws the same error.
Apparently am using loopback, but when using express v4.13.1 throws the error you are getting.
Could it be the node version? Or the loopback library? or Both ? 😣
Saw an issue with node version here #12

from africastalking-node.js.

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.