D is not a function

(megas) #1

I’ve created plugin, under development it works without problem, but in production it produces error:

Uncaught TypeError: d is not a function

How to resolve this problem? How to explore this kind of error?

(Mittineague) #2

Your dev tools should provide info about the file and line number where the code errors, or does it not?

My guess is this is a string - stringArray thing and the “d” is the “d” from “discourse.some-function.object”

Can you post that bit of code here or better yet post a link to your GitHub repo?

(megas) #3

Yes, it has info where the error code appeared, but I guessed it’s not relevant to error itself (because of compressing i think). Here’s the snippet where it happens:

_initGoogleDFP: (function () {
  var self = this;
  loadGoogle().then(function () { <==== Uncaught TypeError: d is not a function
    console.log('promise is fullfiled');

You can check this error on, open dev tool of course.

(Mittineague) #4

Whew boy, that’s one massive JavaScript file with over 114K lines!

And it looks like my initial guess is likely wrong. Because the script uses single letter variable names ie. var d = the d that is not a function could very well be a variable.

If your development is on localhost and your production is on a live host, maybe something isn’t loading in before the script tries to use it?