Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"pbjs is not defined" error from appnexus adapter on recent commits #635

Closed
brondsem opened this issue Sep 15, 2016 · 6 comments
Closed
Labels

Comments

@brondsem
Copy link
Contributor

Starting with commit 6931d45, when the appnexus adapter is enabled, this error is thrown: Uncaught ReferenceError: pbjs is not defined

It's on this line: pbjs.handleAnCB = function (jptResponseObj) {

And the previous part of the call stack is:

    exports.createNew = function () {
      return new AppNexusAdapter();
    };
@mkendall07
Copy link
Member

I'm not seeing this error. Do you have more details you can provide to replicate the issue?

@mkendall07
Copy link
Member

Also, the commit referenced doesn't actually touch appnexus.js file. Is that the adapter you are working with or are you using appnexusAst.js ?

@brondsem
Copy link
Contributor Author

Yea, we are using appnexus (and brealtime). I don't get why the commit would cause the error either. We are running with several adapters and a customized ga.js. When I have a chance, I will simplify the build configuration to narrow things down, and will post an update or jsfiddle

@brondsem
Copy link
Contributor Author

The error occurs with just the appnexus adapter included and nothing else. Or with the standard default set of adapters, in which case you get a similar error for aardvark: Uncaught TypeError: Cannot set property 'aardvarkResponse' of undefined

The key is if have var pbjs = pbjs || {}; before prebid.js or not. If you do, that protects from the error (although I wonder even if you have that, do the callbacks added to pbjs work if it pbjs object isn't the right one yet?). In our case we put our prebid.js script tag before everything else on the page so it can start being loaded as soon as possible.

@mkendall07
Copy link
Member

@brondsem
Thanks for the additional info. We actually do have a line that should protect against this:
https://github.com/prebid/Prebid.js/blob/master/src/prebid.js#L9

It may be possible that webpack is re-ordering the compiled JS so that adapters are parsed before prebid.js.

@mkendall07
Copy link
Member

I figured this out, the global definition needs to come before the imports in prebid.js. I'll add a PR for fix. Thanks!

(this happened because of nested dependencies in video.js - which ends up loading adapters first)

@mkendall07 mkendall07 added the bug label Sep 16, 2016
mkendall07 added a commit that referenced this issue Sep 16, 2016
marian-r added a commit to aol/Prebid.js that referenced this issue Sep 23, 2016
…3.0 to master

* commit '9d4bc7fda6bcc249544fb8636b98e90fdc8d474b': (44 commits)
  Added support for new adapters introduced in 0.13.0 into AOL analytics
  Updated CHANGELOG
  Fixed merge conflict
  Prebid 0.13.0 Release
  Resolves prebid#635 (prebid#640)
  Add IX Deal Support (prebid#638)
  Bug fix: accept custom timeout prebid#582 & prebid#604 (prebid#641)
  added timeouts to rubicon adapter that consider time-to-start costs (prebid#629)
  Modify handling of no-bids in Krux Link adapter (prebid#628)
  Allow bypassing ajax preflights with config options (prebid#630)
  validateIndentation: Invalid indentation character (prebid#631)
  use `splice` rather than `slice` to remove bids from array (prebid#637)
  delete the callback before calling clearAuction (prebid#636)
  Deal override fix to resolve prebid#618 (prebid#619)
  Update package.json
  Video - create mastertagUrl from adservertag (prebid#614)
  Prevent renderAd from rendering videos (prebid#623)
  Remove unused build depencencies (prebid#622)
  Add pull request template (prebid#615)
  Openx adaptor deal update (prebid#612)
  ...
Studnicky pushed a commit to sonobi/Prebid.js that referenced this issue Oct 4, 2016
Studnicky pushed a commit to sonobi/Prebid.js that referenced this issue Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants