Issue with Bluebird.promisify()See original GitHub issue
Tried promisifying the sendEmailBatch function and it gave me a peculiar error…
I tried using the callback style and it works, but promises are a must-have in my current project.
Here’s the code:
const Promise = require('bluebird'); const postmark = require('postmark'); const client = new postmark.Client(<api_key>); const messages = ; // array or message objects const sendEmails = Promise.promisify(client.sendEmailBatch); return sendEmails(messages);
Unhandled rejection TypeError: this.processRequestWithBody is not a function at Client.sendEmailBatch (/<project path>/node_modules/postmark/lib/postmark/Client.js:120:14)
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
We just released
1.4.0 of the library, which includes
Promise support. To get Promises back, simply call the same client methods without a callback function. The client methods will return a Promise when the callback function is emitted.
as an FYI, this is not an issue with postmark.js but an issue with how you’re using
Promise.promisify. You must bind the correct context to the function you are “promisifying”