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

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

Closed
tbsmark86 opened this issue Feb 9, 2023 · 5 comments
Assignees
Labels

Comments

@tbsmark86
Copy link

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.

@ChrisHuie
Copy link
Collaborator

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

@tbsmark86
Copy link
Author

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

@patmmccann patmmccann changed the title Missing error callback for ajax() cause "g.error is not a function" Criteo ID Module: Missing error callback for ajax() cause "g.error is not a function" Mar 27, 2023
@patmmccann
Copy link
Collaborator

@allanjun could you take a look?

@patmmccann patmmccann added the bug label Mar 27, 2023
@leonardlabat
Copy link
Contributor

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

@allanjun
Copy link
Collaborator

allanjun commented Apr 7, 2023

fixed via #9754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

5 participants