Skip to content

Sparkpost with Node.js transmission error #247

Description

@matthewshipman40

I'm having some trouble sending my first email via Sparkpost with node.JS. Any thoughts on trouble shooting would be greatly appreciated. The code below is part of a google cloud function that always returns the following error object:

{ Error: getaddrinfo EAI_AGAIN api.sparkpost.com:443
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'api.sparkpost.com',
host: 'api.sparkpost.com',
port: '443' }

/////////// Code ///////////////
const SparkPost = require('sparkpost')
const client = new SparkPost('06b7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

exports.sendMail = functions.https.onCall((context) => {
client.transmissions.send({
content: {
from: 'dropaprop.com', // this is the actual verified domain. I also tried myname@dropaprop.com where "myname" is an established email address
subject: 'Hello from node-sparkpost',
html: '

Hello world

'
},
recipients: [
{address: 'matthewshipman40@gmail.com'}
]
})
.then(data => {
console.log('Woohoo! You just sent your first mailing!')
console.log(data)
})
.catch(err => {
console.log('Whoops! Something went wrong')
console.log(err)
})
})

/////////////// END CODE ///////////////

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions