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.

HPE_INVALID_CONSTANT

See original GitHub issue

I’m getting [Error: Parse Error] bytesParsed: 0, code: ‘HPE_INVALID_CONSTANT’ when I run this:

'use strict';
var ses = require('node-ses'),
    client = ses.createClient({ key: '*****', secret: '*****', amazon: 'https://email-smtp.us-east-1.amazonaws.com' });

client.sendemail({
    to: 'test@test.com',
    from: 'reminders@test.com',
    subject: 'Sending email through Node and Amazon SES Test',
    message: 'Did you get this?',
    altText: 'Did you get this?'
}, function (err, data, res) {
    console.log('res= ' + res);

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

    console.log(data);
});

Any thoughts?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
joIiviercommented, Mar 27, 2017

The issue is likely due to the fact that the amazon server url you used is the one for the SMTP API, not the HTTP API. (You receive SMTP responses that cant be understood by node hence the error). So you should fix your server url, replace email-smtp by just email.

I just spent a lot of hours on this issue in my project since no tool can help you at this point. I just found by testing my credentials with postman and searching for the errors postman managed to print. These were SMTP errors that gave a clue of what was going on.

1reaction
markstoscommented, Jul 8, 2015

Not off hand. Try googling that error code or generating a stack trace to see which code is generating that error. Re-open if it appears to be a bug in node-ses. You can try using console.trace instead of console.log for that purpose.

https://nodejs.org/api/console.html#console_console_trace_message

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does this error mean: HPE_INVALID_CONSTANT?
The HPE_INVALID_CONSTANT means Http Parse Error and the invalid constant means that the response is malformed. So the parser can't parse it!
Read more >
What does this error mean: HPE_INVALID_CONSTANT?
In this error HPE means (Http Parse Error), and not the HPE company. This error comes from Node.js, and usually indicates Node.js couldn't...
Read more >
HPE_INVALID_CONSTANT Errors with HTTP/TCP · Issue #4863
HPE_INVALID_CONSTANT means that the start of the response is invalid (i.e. doesn't start with "HTTP".) I am skeptical about this being a bug ......
Read more >
Hpe_invalid constant - General - Node-RED Forum
Any ideas community? Well it means that there is something wrong with the response from the server - normally it means the header...
Read more >
Data retrieval - getting HPE_INVALID_CONSTANT
Hello Support, New IoTaWatt owner here, and first time poster… It looks like I'm having some trouble retrieving data from the unit, ...
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