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

Appnexus Adapter: bug during conversion of ortb2 keyword strings to object format #9006

Closed
anitaschiller opened this issue Sep 16, 2022 · 3 comments · Fixed by #9012
Closed
Assignees
Labels

Comments

@anitaschiller
Copy link

Type of issue

Bug

Description

When loading ads, the browser console shows an error in the Appnexus adapter with the information that string.split() cannot be used on undefined.

I think this is caused by ortb2ImpKwStr being undefined (see screenshot below).

let ortb2ImpKwStr = deepAccess(bid, 'ortb2Imp.ext.data.keywords');
if ((isStr(ortb2ImpKwStr) && ortb2ImpKwStr !== '') || !isEmpty(bid.params.keywords)) {
// convert ortb2 from comma list string format to bid param object format
let ortb2ImpKwObj = convertStringToKeywordsObj(ortb2ImpKwStr);

The function convertStringToKeywordsObj still gets called and split() is trying to be used on keyStr which is undefined.

function convertStringToKeywordsObj(keyStr) {
let result = {};
// will split based on commas and will eat white space before/after the comma
let keywordList = keyStr.split(/\s*(?:,)\s*/);

Screenshot

Screenshot 2022-09-15 at 18 44 39

Platform details

Prebid.js version 7.15

Other information

Probably connected to this PR.

@jsnellbaker
Copy link
Collaborator

@anitaschiller Thank you for reporting and investigating this issue. I have put together a fix for this scenario (see above). It should hopefully be merged soon.

@muuki88
Copy link
Collaborator

muuki88 commented Sep 16, 2022

The bug is triggered if you set params.keywords , but not in ortb2Imp.ext.data.keywords .

@jsnellbaker
Copy link
Collaborator

The issue was within the new function that was designed to help transform the structure of the ortb keywords; it unfortunately didn't properly handle an undefined state that came when you only had bid param keywords present.

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.

4 participants