TypeError: Object #<Header> has no method 'toJsonString'
I just re-installed all of my modules from dependencies and sendgrid is now throwing errors. Not sure why is that?
(function() {
var config = require('./config')()
, sendgrid = require('sendgrid')(config.sendgrid.username, config.sendgrid.password)
, email;
// Also tried: sendgrid = require('sendgrid')(config.sendgrid.username, config.sendgrid.password, {api: config.sendgrid.api})
sendgrid.send({
to: '[email protected]',
from: '[email protected]',
subject: 'Account Activation',
text: 'Banana Song?'
}, function(err, msg) {
console.log(arguments);
})
})();
but everytime it throws:
TypeError: Object #<Header> has no method 'toJsonString'
Before digging, I thought to post the issue if that's already fixed or in pipe! Thanks!
See the solution in #113
rm -rf node_modules
npm install
@brandonmwest I still can't find it working as its still a bit of old copy.
// Line: 131
'x-smtpapi' : this.smtpapi.toJsonString(),
Re-building the modules (by running npm install) and even npm update the job. Can you please verify if it's updated over npmjs ?
Well that's weird. npm is updated. @scottmotte any ideas?
Looking now.
@ArkeologeN @brandonmwest
So I just created a new project with this:
{
"name": "Test",
"description": "test_node",
"version": "0.0.1",
"private": true,
"dependencies": {
"sendgrid": "1.0.0-rc.1.0"
}
}
And I'm seeing this:
// Line 140
'x-smtpapi' : this.smtpapi.jsonString(),
So on a fresh npm install it works, might be an issue with npm update: @ArkeologeN can you post your package.json up and confirm that you did a rm -rf node_modules && npm install?
@ArkeologeN yep, what @siyegen said. I also just did a test using: https://github.com/scottmotte/sendgrid-nodejs-example
@ArkeologeN if you'd prefer to email your package.json, please do to me at [email protected]
@scottmotte hey it works after changing from "sendgrid" : "*" to "sendgrid": "1.0.0-rc.1.0".
However, the npm is still showing old revision here: Sendgid
Ok, cool.
@ArkeologeN so npm will always have the old versions. It maintains the old versions so that people can still use older versions if they'd like.
1.0.0-rc.1.0 is the newest (but BETA Release Candidate).
0.4.6 is the newest STABLE
Right, thanks!
Issue is still present in latest version on npm (1.0.0-rc.1.0) I got around it by changing "sendgrid" : "*" to "sendgrid": "0.4.6" in the package.json.