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.

Not able to send email: Unsuccessful:(400)

See original GitHub issue

Hi All,

I tried the demo code provided and I am facing an error.

This error only occurs when I use my paid account instead of test account.

This is my code: `var mailjet = require (‘./mailjet-client’) .connect(‘XXXXXXXXXXXXXXXXXXXXXXXX’, ‘XXXXXXXXXXXXXXXXXXXXXXXX’)

function handleError (err) { console.log(err); throw new Error(err.ErrorMessage); }

function newContact (email) { mailjet.post(‘contact’) .request({Email: email}) .catch(handleError); }

function testEmail (text) { email = {}; email.FromName = ‘Your Name’; email.FromEmail = ‘Your Sender Address’; email.Subject = ‘Test Email’; email.Recipients = [{Email: ‘Your email’}]; email[‘Text-Part’] = text;

mailjet.post(‘send’) .request(email) .catch(handleError); }

testEmail(‘Hello World!’);`

This is my Error: Error: Unsuccessful at /home/lt-101/Folder/node_modules/node-mailjet/mailjet-client.js:220:23 at Request.callback (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/index.js:699:3) at /home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/index.js:868:18 at IncomingMessage.<anonymous> (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/parsers/json.js:16:7) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) ErrorMessage: 'Bad Request', statusCode: 400, response: Response { domain: null, _events: {}, _eventsCount: 0, _maxListeners: undefined, res: IncomingMessage { _readableState: [Object], readable: false, domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, socket: [Object], connection: [Object], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Object], trailers: {}, rawTrailers: [], upgrade: false, url: '', method: null, statusCode: 400, statusMessage: 'Bad Request', client: [Object], _consuming: true, _dumped: false, req: [Object], text: '{"Errors":[{"ErrorIdentifier":"734c0518-b622-4a7f-999e-099d50cd032a","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["FromName"]},{"ErrorIdentifier":"7d57ed98-181e-47bb-a886-4a29ed4def91","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["FromEmail"]},{"ErrorIdentifier":"6a1767e1-6782-47af-a503-cc971d904857","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Subject"]},{"ErrorIdentifier":"7dcda3e0-398a-4b62-ad99-8673d154e4fb","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Recipients"]},{"ErrorIdentifier":"66027d33-1114-4c87-87ed-eb1bb634d841","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Text-Part"]},{"ErrorIdentifier":"6a4b9008-8652-4bc8-b120-b342c1c59c47","ErrorCode":"mj-0003","StatusCode":400,"ErrorMessage":"Missing mandatory property.","ErrorRelatedTo":["Messages"]}],"Messages":null}', read: [Function] }, request: Request { domain: null, _events: {}, _eventsCount: 0, _maxListeners: undefined, _agent: false, _formData: null, method: 'POST', url: 'https://api.mailjet.com/v3.1/send', _header: [Object], header: [Object], writable: true, _redirects: 0, _maxRedirects: 5, cookies: '', qs: {}, _query: [], qsRaw: [], _redirectList: [], _streamRequest: false, _data: [Object], req: [Object], protocol: 'https:', host: 'api.mailjet.com', _endCalled: true, _callback: [Function], res: [Object], response: [Circular], called: true }, req: ClientRequest { domain: null, _events: [Object], _eventsCount: 3, _maxListeners: undefined, output: [], outputEncodings: [], outputCallbacks: [], outputSize: 0, writable: true, _last: true, upgrading: false, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedHeader: [Object], _contentLength: 160, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Object], connection: [Object], _header: 'POST /v3.1/send HTTP/1.1\r\nHost: api.mailjet.com\r\nAccept-Encoding: gzip, deflate\r\nuser-agent: mailjet-api-v3-nodejs/3.2.1\r\nContent-type: application/json\r\nAuthorization: Basic NWI2NmU3YmM3ZDQzNzM1ODEyOTA4YzMxMWEyNDI2YmE6NDM0NGU3MzI5YjgzZmM5Yzc5YjcwOTU2YTM0YzI0NjY=\r\nContent-Length: 160\r\nConnection: close\r\n\r\n', _headers: [Object], _headerNames: [Object], _onPendingData: null, agent: [Object], socketPath: undefined, timeout: undefined, method: 'POST', path: '/v3.1/send', _ended: true, parser: null, res: [Object] }, text: '{"Errors":[{"ErrorIdentifier":"734c0518-b622-4a7f-999e-099d50cd032a","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["FromName"]},{"ErrorIdentifier":"7d57ed98-181e-47bb-a886-4a29ed4def91","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["FromEmail"]},{"ErrorIdentifier":"6a1767e1-6782-47af-a503-cc971d904857","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Subject"]},{"ErrorIdentifier":"7dcda3e0-398a-4b62-ad99-8673d154e4fb","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Recipients"]},{"ErrorIdentifier":"66027d33-1114-4c87-87ed-eb1bb634d841","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Text-Part"]},{"ErrorIdentifier":"6a4b9008-8652-4bc8-b120-b342c1c59c47","ErrorCode":"mj-0003","StatusCode":400,"ErrorMessage":"Missing mandatory property.","ErrorRelatedTo":["Messages"]}],"Messages":null}', body: { Errors: [Object], Messages: null }, files: undefined, buffered: true, headers: { 'content-length': '1049', 'content-type': 'application/json; charset=UTF-8', date: 'Mon, 11 Sep 2017 17:05:58 GMT', connection: 'close' }, header: { 'content-length': '1049', 'content-type': 'application/json; charset=UTF-8', date: 'Mon, 11 Sep 2017 17:05:58 GMT', connection: 'close' }, statusCode: 400, status: 400, statusType: 4, info: false, ok: false, redirect: false, clientError: true, serverError: false, error: { Error: cannot POST /v3.1/send (400) at Response.toError (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/response.js:94:13) at ResponseBase._setStatusProperties (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/response-base.js:122:16) at new Response (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/response.js:40:8) at Request._emitResponse (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/index.js:723:20) at /home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/index.js:868:38 at IncomingMessage.<anonymous> (/home/lt-101/Folder/node_modules/node-mailjet/node_modules/superagent/lib/node/parsers/json.js:16:7) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) status: 400, text: '{"Errors":[{"ErrorIdentifier":"734c0518-b622-4a7f-999e-099d50cd032a","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["FromName"]},{"ErrorIdentifier":"7d57ed98-181e-47bb-a886-4a29ed4def91","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["FromEmail"]},{"ErrorIdentifier":"6a1767e1-6782-47af-a503-cc971d904857","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Subject"]},{"ErrorIdentifier":"7dcda3e0-398a-4b62-ad99-8673d154e4fb","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Recipients"]},{"ErrorIdentifier":"66027d33-1114-4c87-87ed-eb1bb634d841","ErrorCode":"send-0001","StatusCode":400,"ErrorMessage":"Not a valid property.","ErrorRelatedTo":["Text-Part"]},{"ErrorIdentifier":"6a4b9008-8652-4bc8-b120-b342c1c59c47","ErrorCode":"mj-0003","StatusCode":400,"ErrorMessage":"Missing mandatory property.","ErrorRelatedTo":["Messages"]}],"Messages":null}', method: 'POST', path: '/v3.1/send' }, accepted: false, noContent: false, badRequest: true, unauthorized: false, notAcceptable: false, forbidden: false, notFound: false, type: 'application/json', charset: 'UTF-8', links: {}, setEncoding: [Function: bound ], redirects: [] } }

Thank you.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ghosthypercommented, Oct 28, 2018

const request = this.objMail .post(“send”, { ‘version’: ‘v3.1’ }) .request({ “Messages”: [ { “From”: { “Email”: this._config.mail_from }, “To”: [ { “Email”: to } ], “Subject”: subject, “HTMLPart”: html } ] }); request .then((result) => { console.log(‘Success’); console.log(result); }) .catch((err) => { console.log(err); console.log(err.statusCode); });

– Getting Error - Unsuccessful: null Parse Error

Complete error log - { Error: Unsuccessful: null Parse Error at /home/XXXXX/XXXX//node_modules/node-mailjet/mailjet-client.js:321:23 at Request.callback (/home/XXXXX/XXXX/node_modules/superagent/lib/node/index.js:728:3) at ClientRequest.req.once.err (/home/XXXXX/XXXX/node_modules/superagent/lib/node/index.js:647:10) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketOnData (_http_client.js:445:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:607:20) ErrorMessage: ‘Parse Error’, ErrorIdentifier: undefined, statusCode: null, response: null, message: ‘Unsuccessful: null Parse Error’ }

0reactions
julesmqzcommented, Jul 13, 2019

I’m having the same issue as ghosthyper

mailjet = require(‘node-mailjet’).connect(‘XXXXXXX’, ‘XXXXX’, { url: ‘in-v3.mailjet.com’, // default is the API url version: ‘v3.1’, // default is ‘/v3’ perform_api_call: true // used for tests. default is true });

mailjet.post(“send”).request({ “Messages”: [ { “From”: { “Email”: “pilot@mailjet.com”, “Name”: “Mailjet Pilot” }, “To”: [ { “Email”: “julesmqz@gmail.com”, “Name”: “Julio Marquez” } ], “Subject”: “Your email flight plan!”, “TextPart”: “Dear passenger 1, welcome to Mailjet! May the delivery force be with you!”, “HTMLPart”: “

COOL

” } ] }).then((result) => { console.log(‘Success’); console.log(result); }) .catch((err) => { console.log(err); console.log(err.statusCode); });

{ Error: Unsuccessful: null Parse Error at /Applications/XAMPP/xamppfiles/htdocs/zoogdl/functions/node_modules/node-mailjet/mailjet-client.js:321:23 at Request.callback (/Applications/XAMPP/xamppfiles/htdocs/zoogdl/functions/node_modules/superagent/lib/node/index.js:728:3) at ClientRequest.req.once.err (/Applications/XAMPP/xamppfiles/htdocs/zoogdl/functions/node_modules/superagent/lib/node/index.js:647:10) at Object.onceWrapper (events.js:286:20) at ClientRequest.emit (events.js:198:13) at TLSSocket.socketOnData (_http_client.js:448:9) at TLSSocket.emit (events.js:198:13) at addChunk (_stream_readable.js:288:12) at readableAddChunk (_stream_readable.js:269:11) at TLSSocket.Readable.push (_stream_readable.js:224:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17) ErrorMessage: ‘Parse Error’, ErrorIdentifier: undefined, statusCode: null, response: null, message: ‘Unsuccessful: null Parse Error’ }

Read more comments on GitHub >

github_iconTop Results From Across the Web

"400 Bad Request" error when you send an email message to ...
Fixes an issue that triggers a "400 Bad Request" error when you send an email message to SharePoint that is greater than 2MB...
Read more >
Resolve the 554 or 400 "Message rejected" error on Amazon ...
To resolve 554 or 400 "Message rejected" errors with the message "Email address is not verified," check the following: Open the Amazon SES ......
Read more >
How to Fix the 400 Bad Request Error - Lifewire
The 400 Bad Request error means that the request you sent to the website server to view the page was somehow incorrect.
Read more >
Reolink Camera Email Test Failed and Show 400 Error on ...
Solution: Google the SMTP Server & SMTP port of your email service and input the correct info. Then you may click on E-mail...
Read more >
How to Fix a 400 Bad Request Error: 8 Easy Methods
The error 400 bad request happens when the server can't understand the request. Thus, it won't process it and will send you the...
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