Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Criteo ID Module: Missing error callback for ajax() cause "g.error is not a function"

Open tbsmark86 opened this issue 3 years ago • 5 comments

Type of issue

Bug. Likely no relevant effect aside from message on browser console

Description

My js bug reporting sees some of these events for real users: TypeError: g.error is not a function

According to the available stacktrace it's caused src/ajax.js here: callbacks.error(x.statusText, x); for some unknown Network reason.

I've found at least one module from my list that uses an ajax() call with an object as argument but only a success callback which is probably the root cause: criteoIdSystem.

I don't know if the module is violating the intended API or if the ajax() call should check if that error callback is available.

Expected results

Handle network error with some simple log entry

Actual results

Uncaught javascript error

Platform details

Prebid 7.35.0 unknown bundle details.

tbsmark86 avatar Feb 09 '23 08:02 tbsmark86

@tbsmark86 can you please add a test page for this issue?

ChrisHuie avatar Feb 13 '23 16:02 ChrisHuie

I don't know what you expect as a test page and I don't know how to configure prebid myself. I've just traced the error appearing in my sentry.io-style-tool back to this.

Wild guess for a test case:

import { ajax } from '../src/ajax.js';

 ajax(
      'http://some-url-that-will-always-fail.org/'
      {
        success: response =>  { console.log('imposible'); }
        // note missing error callback
      },
      undefined,
      { method: 'GET', withCredentials: true }
    );

That's somewhat copy&paste from modules/criteoIdSystem.js ~ line 95

tbsmark86 avatar Feb 13 '23 19:02 tbsmark86

@allanjun could you take a look?

patmmccann avatar Mar 27 '23 19:03 patmmccann

Hello @patmmccann We've logged the issue internally & we'll push a PR to fix it later this week

leonardlabat avatar Mar 28 '23 15:03 leonardlabat

fixed via https://github.com/prebid/Prebid.js/pull/9754

allanjun avatar Apr 07 '23 08:04 allanjun