Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'sendSms' of undefined Help #84

Closed
Cmarenburg opened this issue Nov 16, 2016 · 3 comments
Closed

TypeError: Cannot read property 'sendSms' of undefined Help #84

Cmarenburg opened this issue Nov 16, 2016 · 3 comments

Comments

@Cmarenburg
Copy link

Cmarenburg commented Nov 16, 2016

Hey Guys,

So I've run into an issue when I go and try to send an SMS and it seems like nexmo isn't being defined at all. I've tried this on staging a local however I can't seem to resolve the issue. Here's the code I have

Init.

    const Nexmo = require('nexmo');
    const nexmo = Nexmo({ apiKey: 'super', apiSecret: 'Secret' });

    nexmo.message.sendSms(sender,recipent,message,{},function(err, message){

	    if (err) {
		    console.log(err);
	   }
    
    });

and here's the error

    TypeError: Cannot read property 'create' of undefined
        at Object.<anonymous> (C:\Users\User\Documents\Projects\project\testing.js:25:12)
        at Module._compile (module.js:570:32)
        at Object.Module._extensions..js (module.js:579:10)
       at Module.load (module.js:487:32)
       at tryModuleLoad (module.js:446:12)
       at Function.Module._load (module.js:438:3)
       at Module.runMain (module.js:604:10)
       at run (bootstrap_node.js:394:7)
       at startup (bootstrap_node.js:149:9)

Any ideas or help?
Thanks, Colin

@leggetter
Copy link
Contributor

Hi @Cmarenburg,

What is on line 25 of testing.js? The stacktrace doesn't seem to suggest this is a problem with the nexmo module, but if you could share what's on that line and what the create function is being called on I'll have a better idea.

Thanks.

@Cmarenburg
Copy link
Author

Cmarenburg commented Nov 17, 2016

My bad - the original trace was from when I was trying to test to see if the calling worked. However the stack trace for sending an SMS is pretty much the same with the exception of

TypeError: Cannot read property 'sendSms' of undefined

It's running into the issue when ever I try to send an SMS or Call ( haven't tested other nexmo features).

nexmo.message.sendSms(sender,recipent,message,null,function(err, message){

throws a Cannot read property 'sendSms' of undefined

or when trying to call

nexmo.calls.create({})

throws a TypeError: Cannot read property 'create' of undefined.

I'm not totally sure what is going on. Node version is 6.9.1 and nexmo version is 0.0.7

@leggetter
Copy link
Contributor

The latest version of nexmo is 1.1.0 so I'd definitely recommend updating to that version. Before 1.0 nexmo only had functions directly off of that object.

So, try updating to the new version. I'm reasonably sure that'll resolve this. Please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants