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

Uncaught TypeError: Cannot read property 'map' of undefined #4035

Closed
spormeon opened this issue Jul 29, 2019 · 13 comments
Closed

Uncaught TypeError: Cannot read property 'map' of undefined #4035

spormeon opened this issue Jul 29, 2019 · 13 comments
Labels

Comments

@spormeon
Copy link

started getting this in v 2.20 onwards, not a clue what it is:
Uncaught TypeError: Cannot read property 'map' of undefined
at Object.getUserSyncs (prebid2.25.0adyjs.js:4)
at Object.p [as registerSyncs] (prebid2.25.0adyjs.js:3)
at prebid2.25.0adyjs.js:26
at Array.forEach ()
at prebid2.25.0adyjs.js:26
at prebid2.25.0adyjs.js:26
at Object.success (prebid2.25.0adyjs.js:26)
at XMLHttpRequest.onreadystatechange (prebid2.25.0adyjs.js:3)

@snapwich
Copy link
Collaborator

What bidders are you using? This is a specific error inside of a bid adapter.

@spormeon
Copy link
Author

workspace-sts-3_8_3_RELEASE_-Java-prebid-header-bidding_prebid_timhanlon_tweaktownhjgjhg756676_js-_Spring_Tool_Suite

workspace-sts-3_8_3_RELEASE_-Java-prebid-header-bidding_prebid_timhanlon_tweaktownhjgjhg756676_js-_Spring_Tool_Suite-2

@snapwich
Copy link
Collaborator

Given those bidders I would have to guess the issue stems from the recent changes to the 33acrossBidAdapter in #3944

Specifically the unsafe access of adapterState.uniqueSiteIds.map here.

You can try removing that bidder to see if that fixes your issue.

cc: @curlyblueeagle

@spormeon
Copy link
Author

spormeon commented Jul 29, 2019

ye, it was 33across, any fix for it?

actually the error is only there when using 33across S2S, bring it client side and the error goes away

@snapwich
Copy link
Collaborator

The immediate fix would probably be adding safe lookup to check for an undefined property, however the bug highlights a more serious code smell in that shared state is being stored outside buildRequests and getUserSyncs. This pattern could lead to unexpected behavior depending on run order (in this case I think you may be using prebid-server so buildRequests is never called since there are no client requests?) but also could cause edge case bugs around concurrent auctions.

The code should probably be refactored to only operate on function parameters instead of shared closure state. I cc'd @curlyblueeagle as this is a fix they'd probably have to make.

@spormeon
Copy link
Author

ok, yes using prebid-server. One other odd thing noticed, is 33accross makes bids on S2S and is quite often the highest bidder but it never wins a bid or renderers an ad

@curlyblueeagle
Copy link
Contributor

@snapwich we could fix the bug in the short-term by adding a safe lookup check. But we are forced to use shared state because we require parameters from all bid requests during user sync. I believe the utils library used to expose a method to obtain this during pre v1 days, but no longer. We tried to do user sync during interpretResponse #2024 , but that wasn't the ideal solution since we wanted to delink usersyncing from auction for the sake of performance. So we implemented the shared state in #2899.

Do you have a recommendation on how we can obtain params to bidrequests safely via a function?

@snapwich
Copy link
Collaborator

I believe most bidders return custom sync urls in their bid responses if they require custom sync data (beyond cookie data). You could do the same.

@curlyblueeagle
Copy link
Contributor

copying @thomas-33across since he will be following up on this issue.

@curlyblueeagle
Copy link
Contributor

hmm @thomas-33across says he is unable to add comment to this thread. Why?

@thomas-33across
Copy link
Contributor

Hello @spormeon can you tell me your prebid.js setup page so I can try to reproduce the issue and make the code change? Thank you

@spormeon
Copy link
Author

spormeon commented Aug 5, 2019

@thomas-33across unfortunately not, as its on test pages behind logins, where i test out new prebid releases not live sites

@stale
Copy link

stale bot commented Aug 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

4 participants