mailgun-js-boland icon indicating copy to clipboard operation
mailgun-js-boland copied to clipboard

cannot read property cache of undefined

Open EliArtist opened this issue 5 years ago • 2 comments

  1. What version of the module is the issue happening on? Does the issue happen on latest version? 0.20.0

  2. What platform and Node.js version? (For example Node.js 6.9.1 on Mac OS X) node 8.11.4, Linux Arch

I got quite the confusing error here... reproduction code is just 2 lines, because i cant get any further with that.

const mailgun = require('mailgun-js')({
  apiKey: '<api-key>',
  domain: '<domain>',
});
console.log(mailgun);

I always get this error and cant get behind it.

TypeError: Cannot read property 'cache' of undefined
at Object.<anonymous> (<...>/node_modules/ftp/lib/parser.js:8:28)

It seems like mailgun-js has a dependency on proxy-agent what has a indirect dependency on ftp what throws the error. Now I dont know if this is a problem with mailgun-js or at least caused by mailgun-js. Could you help with that? Or do you have at least a hint where to look further into this? Thanks in advance

EliArtist avatar Sep 03 '18 16:09 EliArtist

Hmm i can't seem to reproduce this. Can you check version 0.21.0.

bojand avatar Sep 18 '18 00:09 bojand

Got the same error with v 0.22. For me it was related to the build process with webpack. Solved it by using the webpack-node-externals and slightly adapted webpack.config.js:

const nodeExternals = require('webpack-node-externals');
...
  externals: [nodeExternals()],
...

MainAero avatar May 26 '20 18:05 MainAero