Closed dimoooooooon closed 8 years ago
Yes, I also have this error for about a month
Hi,
Can either of you provide more detail? I've just tried sending emails using the plugin and everything still seems to be running without issue. Emails are being added to Mailgun, so it may be an issue with how it's being used on your end, or a use-case I haven't considered.
So the more detail you guys can provide the better.
Thanks in advance.
Hi,
Below my package.json content
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {
"browser-sync": "^2.9.11",
"gulp-autoprefixer": "^3.1.0",
"gulp-file-include": "^0.13.7",
"gulp": "^3.9.0",
"gulp-ftp": "^1.0.4",
"gulp-inline-css": "^3.0.0",
"gulp-inline-source": "^2.1.0",
"gulp-mailgun": "^0.0.4",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.0.1",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-sass": "^2.1.0",
"gulp-sourcemaps": "^1.6.0",
"run-sequence": "^1.1.4"
},
"devDependencies": {
"gulp-premailer": "^0.4.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
my Gulp Task
gulp.task('send', function() {
runSequence('sendmail');
});
gulp.task('sendmail', function () {
gulp.src(config.nimailtesturl+'test.html')
.pipe(plumber({errorHandler: onError}))
.pipe(sendmail({
key: config.nimailkey,
sender: config.nimailsender,
recipient: config.nimailrecipient,
subject: config.nimailsubject
}));
});
and finally, all the error message.
TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:167:9)
at new Buffer (buffer.js:58:10)
at gulpMailgun (/Users/Some/Directories/node_modules/gulp-mailgun/index.js:25:17)
at Gulp.<anonymous> (/Users/Some/Directories/gulpfile.js:175:8)
at module.exports (/Users/Some/Directories/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/Some/Directories/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/Some/Directories/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Users/Some/Directories/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
at doNTCallback0 (node.js:428:9)
at process._tickCallback (node.js:357:13)
at Function.Module.runMain (module.js:459:11)
at startup (node.js:136:18)
at node.js:972:3
My node version is v5.0.0
That error, to my uneducated eye, looks like it's having a hard time of getting the content of the HTML file. The only thing I can think of that could be getting received that isn't a number, buffer, array, or string would be either a null or an undefined.
Is there any way you can check to make sure that the contents of the HTML file are being pulled in correctly at all? Forgive my lack of solid advice, but my understanding of this particular area is rather limited.
Hi again,
Turns out I was wrong. I was looking at the wrong part of my code (the joys of old projects). Turns out it was a much simpler fix, on my end. At some point the Buffer function stopped converting JSON objects into strings, which is what was causing the issue.
If you update to version 0.0.5 everything should, once again, be working.
Cool, there are more than error but now the email does not seem to mailgun from. But there is no trace of mail received or mail sent on mailgun?
Can you provide an updated error message? I've had zero issues with getting things to send since updating the code I released earlier today, so the more detail you can provide the better.
now i have this
[10:50:01] Starting 'send'...
[10:50:01] Starting 'sendmail'...
{ key: 'xxxxx',
sender: 'xxxx@hellodeloo.com',
recipient: 'xxxx@previews.emailonacid.com ',
subject: 'xxxx' }
[10:50:01] Finished 'send' after 11 ms
[10:50:01] Finished 'sendmail' after 16 ms
but no email trace in gunmail and emailonacid
Ah, that output it just some debug code I'd left in by mistake, it's not an error. I have noticed that it seems to be taking Mailgun longer to process emails than previously, with them sitting in a queue for a much longer period of time, usually for 10+ minutes before I'm seeing anything being registered in the app.
It is a bit odd that you're not getting any kind of feedback from the send process itself though, as there should definitely be a "Email sent to xxxx@previews.emailonacid.com" message or an error output because things went wrong.
Looking at your output, it might be the extra space on the end of the xxxx@previews.emailonacid.com email address, though that's something I should be catching on my end (but that I'm apparently not). Could you try taking the extra space out to see if that helps?
There is no extra space in my on on sender or recipient email data. They are the same tasks and configurations that i used it a few weeks ago and working properly
Could you possibly upload a copy of the setup you're using (with keys and so forth removed obviously) so that I can look into this for you?
Alternatively I've just uploaded the bare bones example I've been testing to ensure things are working. All you need to do us update the mailgun settings and you can start sending the test email. It's a very basic example, but it's resulted in a 100% send rate so far. It may be worth trying your markup in my example, in case it's something I've overlooked on my end, as it's cut right back to the minimum required to send emails out.
var config = {
nimailtesturl: 'http://www.xxx.com/xxx/',
nimaillocaldir: 'xxx/',
nimailkey: 'key-xxx,
nimailsender: 'xxx@hellodeloo.com',
nimailrecipient: 'xxx.runme@previews.emailonacid.com',
nimailsubject: 'Email Test: xxx'
};
gulp.task('sendmail', function () {
return gulp.src(config.nimailtesturl+'test.html')
.pipe(plumber({errorHandler: onError}))
.pipe(sendmail({
key: config.nimailkey,
sender: config.nimailsender,
recipient: config.nimailrecipient,
subject: config.nimailsubject
}));
});
gulp.task('send', function() {
runSequence('sendmail');
});
and i run gulp send
Hi,
This is looking like it might be a change in something outside of my package. I can get local files in a project to work, but the second I refer to anything hosted online I'm running into the exact same issue as you.
Given that my package is dependant upon gulp.src passing through these files, I'm not sure that there's anything I can do on my end to work around this. Two things that I'd consider trying to see if either works:
Let me know if you have any luck with either of these, or if you're still running into issues.
I just released another small fix, though this shouldn't affect your issues. It dealt with another issue I spotted whilst trying to resolve this for you.
Try referencing a file in your project rather than one hosted online
Yeah! That's the fix! Thanks
I'm currently on version 0.0.7 and having the same issue as the original poster. Has anything changed?
From dealing with hellodeloo it seems that gulp.src no longer likes to load in remotely hosted files. Switching from a remote file to a local file solved their problem. Are you using a local file or a remote one?
the html file im using is local
Could you possibly share the gulp task you're running, along with any variables that relate to it? A copy of the error output would also be useful
gulp task:
gulp.task('sendmail', function () {
gulp.src( 'dist/index.html')
.pipe(sendmail({
key: 'key-for-mail-gun-here',
sender: 'test@email.com',
recipient: 'test@email.com',
subject: 'This is a test email'
}));
});
error:
TypeError: must start with number, buffer, array or string
at new Buffer (buffer.js:67:11)
at gulpMailgun (/path/to/node_modules/gulp-mailgun/index.js:26:17)
at bound (domain.js:254:14)
at runBound (domain.js:267:12)
at asyncRunner (/path/to/node_modules/gulp/node_modules/undertaker/node_modules/bach/node_modules/async-done/index.js:36:18)
at process._tickDomainCallback (node.js:381:11)
let me know if you need anything else
Node isn't really my forté I'm afraid, so I'm afraid I'm coming up a bit stumped on this. From dealing with the previous individuals this buffer issue seems to be caused because the file itself cannot be uploaded. Can you double check (this is one of those probably not the issue things) that the file is actually there? Sometimes I've found that adding a ./
to the start of gulp.src urls can fix things, so I'd also consider trying that as a just in case measure.
Just tried that with no luck. I even tried an absolute path instead of a relative path. I'll continue to tinker with it to see if i can figure out what's going on.
Ok, finally got it. Since everything was running async, the stream was getting interrupted. I set it up as a separate function instead of a task and it worked! Here's what I needed if anyone else runs into the same issue:
import sendmail from 'gulp-mailgun'; //Using babel
function send(done) {
gulp.src('dist/index.html')
.pipe(sendmail({
key: 'key-for-mailgun',
sender: 'postmaster@sandbox123456.mailgun.org',
recipient: 'me@me.com',
subject: 'This is a test email'
}))
done();
}
Excellent, I'm glad you were able to get things resolved.
I ran into a similiar issue after updating to node v6.2.2
[12:07:28] TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at fromObject (buffer.js:287:9) at Function.Buffer.from (buffer.js:133:10) at new Buffer (buffer.js:112:17) at gulpMailgun (/Applications/MAMP/htdocs/travelocity/node_modules/gulp-mailgun/index.js:25:17)
Hello there, is anybody having this error using gulp-mailgun?
TypeError: must start with number, buffer, array or string at fromObject (buffer.js:167:9) at new Buffer (buffer.js:58:10) at gulpMailgun...