Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@himu62
Copy link
Contributor

@himu62 himu62 commented Jan 21, 2026

Type of change

  • Bugfix

  • Feature

  • New bidder adapter

  • Updated bidder adapter

  • Code style update (formatting, local variables)

  • Refactoring (no functional changes, no api changes)

  • Build related changes

  • CI related changes

  • Does this change affect user-facing APIs or examples documented on http://prebid.org?

  • Other

Description of change

This PR fixes a TypeError that occurs in the priceFloors module when adUnit.bids is undefined.

Error at updateAdUnitsForAuction

TypeError: Cannot read properties of undefined (reading 'forEach')

Other information

This PR solves #14359

…tion

Use optional chaining to safely iterate over adUnit.bids since it can be
undefined in some configurations.

Fixes TypeError: Cannot read properties of undefined (reading 'forEach')
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a TypeError in the priceFloors module that occurs when adUnit.bids is undefined. The error was thrown when updateAdUnitsForAuction attempted to iterate over bids without checking if the array exists.

Changes:

  • Added optional chaining operator to safely handle undefined adUnit.bids in the updateAdUnitsForAuction function
  • Added a test case to verify the function doesn't throw when adUnit.bids is undefined

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
modules/priceFloors.ts Fixed TypeError by using optional chaining (?.) when accessing adUnit.bids
test/spec/modules/priceFloors_spec.js Added test case to verify the fix handles undefined adUnit.bids correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@patmmccann patmmccann merged commit c4063a1 into prebid:master Jan 21, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime Error in priceFloors Module: undefined.forEach when adUnit.bids is undefined in requestBids parameter

2 participants