Mailjet API_KEY is required even with API KEY
See original GitHub issueI’ve got the error Mailjet API_KEY is required my Code:
const express = require('express');
const bodyParser = require('body-parser');
const mailjet = require ('node-mailjet')
.connect(process.env.USER, process.env.PASSWORD)
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(bodyParser.raw());
app.post('/sendMail',async (req, res) => {
mailjet
.post("send", {'version': 'v3.1'})
.request({
"Messages":[{
"From": {
"Email": "leonllrcraft@gmail.com",
"Name": "thesportclinic server"
},
"To": [{
"Email": req.body.to,
"Name": "Alexis"
}],
"Subject": "nouveau demande de rendez-vous",
"TextPart": "",
"HTMLPart": `${req.body.body}`
}]
}).then((result) => {
console.log(result.body)
res.status(200);
})
.catch((err) => {
console.log(err.statusCode)
})
})
app.listen(process.env.PORT)
console.clear()//just for Repl.it don't log express server
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
API Key Configuration - Mailjet for Developers
/apikey. Create a sub-account with a new Public and Secret API Key. API Keys are used as credentials to access the API and...
Read more >What are the API Keys? - Mailjet Help Center
An API Key and Secret Key are secret tokens used by Mailjet to authenticate you with our servers. Your Secret Key is displayed...
Read more >Send API V3.1 - Mailjet for Developers
Mailjet is still supporting Send API V3. ... The mandatory properties for any message element are: ... View : API Key Statistical campaign/message...
Read more >Email API Authentication - Mailjet for Developers
It requires you to provide a username and a password for each API request. The username is your API Key and the password...
Read more >Finding and managing your API credentials | Customer.io Docs
You can find your API keys by navigating to Account Settings > API Credentials. In this settings area, you can add new API...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@leonllrmc @simonlayfield I’m tested this problem and the error is not reproduced.
The error you are getting is generated in file
mailjet-client.js
on line191
:The code check value
apiKey
for not empty value (0, "", null, undefined, NaN
in Boolean have valuefalse
) so you need to check that valuesprocess.env.USER
andprocess.env.PASSWORD
aren’t empty.Please, check you passed values and if error repeat with not empty values provide more information: mailjet-apiv3-nodejs package version, NodeJS version, OS, environment
This issue will be closed