question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Great Library 😃 Though am running into an error when trying to send a simple sms. Seems to be something when returning a promise. Here is the error .then(function(s) { ^

TypeError: Cannot read property 'then' of undefined Code: var AfricasTalking = require('africastalking')(options); 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); });

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pbombocommented, Mar 31, 2016

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

1reaction
roboflankcommented, Apr 1, 2016

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling with promises - The Modern JavaScript Tutorial
Promise chains are great at error handling. When a promise rejects, the control jumps to the closest rejection handler.
Read more >
Promise.prototype.catch() - JavaScript - MDN Web Docs
The catch method is used for error handling in promise composition. Since it returns a Promise , it can be chained in the...
Read more >
Promise Error Handling - JavaScript Tutorial
In this tutorial, you will learn about promise error handling that shows you how to handle error in promises.
Read more >
Promises - Error Handling - Beginner JavaScript - Wes Bos
The way you catch an error in a promise is you chain a .catch() to it. Catch will pass you the error as...
Read more >
How do I handle errors with promises? - Stack Overflow
myFn(param).then(function(calcN){ // here, you throw to raise an error and return to resolve // new Promise should be used only when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found