Skip to content

Sparkpost with Node.js transmission error #247

Open
@matthewshipman40

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 [email protected] where "myname" is an established email address
subject: 'Hello from node-sparkpost',
html: '

Hello world

'
},
recipients: [
{address: '[email protected]'}
]
})
.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 ///////////////

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