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

Pr #8626 breaks prebid when publisher is using the bluebirdjs module #8903

Closed
bjorn-lw opened this issue Aug 26, 2022 · 6 comments · Fixed by #8915
Closed

Pr #8626 breaks prebid when publisher is using the bluebirdjs module #8903

bjorn-lw opened this issue Aug 26, 2022 · 6 comments · Fixed by #8915
Assignees
Labels

Comments

@bjorn-lw
Copy link
Contributor

bjorn-lw commented Aug 26, 2022

Type of issue

Pr #8626 breaks prebid when publisher is using the bluebirdjs module. (https://github.com/petkaantonov/bluebird/)

Description

The bluebirdjs doesn¨t allow "promise" to be subclassed, throwing an error and halting prebid. http://bluebirdjs.com/docs/error-explanations.html#2.-you-are-trying-to-subclass-promise

Steps to reproduce

The easiest way would probably be to use a proxy to redirect https://content.lwadm.com/lw/6.26.0/prebid.js to a version of prebid.js >= 7.7.0 on the site https://www.gp.se.

Test page

See above

Other information

Unfortunately, the publisher using this module cannot remove it or fix the problem easily. I also realize it may not be in the interest of Prebid.org to fix issues specific to a publisher, but I could imagine this might be a problem for more publishers out there + there might be other modules causing similar issues. Also, the publisher is not a small one and not being able to upgrade beyond 7.6.0 will be a major issue. Though we can create a custom branch removing the new functionality, it's not really sustainable in the long run.

One suggestion is to add a config setting to control whether this extended version of promise should be used or not if the problem can't be fixed on the Prebid end?

@patmmccann
Copy link
Collaborator

patmmccann commented Aug 26, 2022

The first link says not to use bluebird on modern browsers. Prebid 6.x+ is only for modern browsers.

'Currently - it is only recommended to use Bluebird if you need to support old browsers"

Repository owner moved this from Triage to Done in Prebid.js Tactical Issues table Aug 26, 2022
@patmmccann
Copy link
Collaborator

patmmccann commented Aug 26, 2022

Apologies closed by pressing the wrong button, but i don't expect we will be fixing this. We released instructions on prebid 6 on how to load old prebid for old browsers . Your potential contribution of a workaround is welcome however!

@patmmccann patmmccann reopened this Aug 26, 2022
Repository owner moved this from Done to Open in Prebid.js Tactical Issues table Aug 26, 2022
@patmmccann patmmccann moved this from Open to Tracking in Prebid.js Tactical Issues table Aug 26, 2022
@patmmccann patmmccann moved this from Tracking to Needs volunteers in Prebid.js Tactical Issues table Aug 26, 2022
@dgirardi
Copy link
Collaborator

dgirardi commented Aug 27, 2022

I believe the error wouldn't happen if Prebid is loaded before bluebird. Would that be a viable fix?

If not, another option could be to have Prebid look for say pbj.Promise and use that if it's defined, so that you could do

<script>
window.pbjs = window.pbjs || {}
window.pbjs.Promise = Promise;
</script>
<!-- load bluebird, prebid, etc -->

@bjorn-lw
Copy link
Contributor Author

Thank you very much for replying!

Unfortunately, the chances that the publisher can make such changes that bluebird is removed from their sites is not a possibility right now as it would requite to large rewrites (which is planned, but won't be ready for a pretty long while).

Also, sticking with older versions of Prebid is not an option either and fact is that it has worked flawlessly up until this change so if this one could be solved it would help a lot.

The suggestion to ensure that Prebid is loaded before bluebird: Unfortunately I don't think that's possible since the actual loading of the site would be delayed by the loading of Prebid.js (which would in that case need to be loaded synchronously I believe).

Your other suggestion, defining "window.pbjs.Promise = Promise" may be a solution that's possible to implement. Let me check that!

@dgirardi
Copy link
Collaborator

After trying some trickery to redirect and inject scripts on https://www.gp.se/ I think the approach will work - if you are able to preprend that snippet before both Prebid and Bluebird, using this pr.

@bjorn-lw
Copy link
Contributor Author

@dgirardi great, thank you very much! The update is on it's way, we'll try it out but it looks like it should work. Thanks again!

Repository owner moved this from Needs OP to Done in Prebid.js Tactical Issues table Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants