Coder Social home page Coder Social logo

Comments (24)

hellodeloo avatar hellodeloo commented on August 19, 2024

Yes, I also have this error for about a month

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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.

from gulp-mailgun.

hellodeloo avatar hellodeloo commented on August 19, 2024

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

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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.

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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.

from gulp-mailgun.

hellodeloo avatar hellodeloo commented on August 19, 2024

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?

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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.

from gulp-mailgun.

hellodeloo avatar hellodeloo commented on August 19, 2024

now i have this

[10:50:01] Starting 'send'...
[10:50:01] Starting 'sendmail'...
{ key: 'xxxxx',
  sender: '[email protected]',
  recipient: '[email protected] ',
  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

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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 [email protected]" message or an error output because things went wrong.

Looking at your output, it might be the extra space on the end of the [email protected] 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?

from gulp-mailgun.

hellodeloo avatar hellodeloo commented on August 19, 2024

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

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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.

from gulp-mailgun.

hellodeloo avatar hellodeloo commented on August 19, 2024
var config = {
    nimailtesturl: 'http://www.xxx.com/xxx/',
    nimaillocaldir: 'xxx/', 
    nimailkey: 'key-xxx,
    nimailsender: '[email protected]',
    nimailrecipient: '[email protected]',
    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

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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:

  1. Try referencing a file in your project rather than one hosted online
  2. If hosting the file online is vital, I'd still suggest trying Point 1 above and, if that works, then I'd look into using this package to see if it allows you to load in content from online locations.

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.

from gulp-mailgun.

hellodeloo avatar hellodeloo commented on August 19, 2024

Try referencing a file in your project rather than one hosted online

Yeah! That's the fix!
Thanks

from gulp-mailgun.

jordanbommelje avatar jordanbommelje commented on August 19, 2024

I'm currently on version 0.0.7 and having the same issue as the original poster. Has anything changed?

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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?

from gulp-mailgun.

jordanbommelje avatar jordanbommelje commented on August 19, 2024

the html file im using is local

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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

from gulp-mailgun.

jordanbommelje avatar jordanbommelje commented on August 19, 2024

gulp task:

gulp.task('sendmail', function () {
  gulp.src( 'dist/index.html')
  .pipe(sendmail({
    key: 'key-for-mail-gun-here',
    sender: '[email protected]',
    recipient: '[email protected]',
    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

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

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.

from gulp-mailgun.

jordanbommelje avatar jordanbommelje commented on August 19, 2024

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.

from gulp-mailgun.

jordanbommelje avatar jordanbommelje commented on August 19, 2024

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: '[email protected]',
    recipient: '[email protected]',
    subject: 'This is a test email'
  }))
  done();
}

from gulp-mailgun.

davidturner avatar davidturner commented on August 19, 2024

Excellent, I'm glad you were able to get things resolved.

from gulp-mailgun.

milliephanillie avatar milliephanillie commented on August 19, 2024

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)

from gulp-mailgun.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.