RoyBarOn
RoyBarOn

Reputation: 987

How to trace the source error of ERROR TypeError: You provided 'undefined' where a stream was expected?

I know this error has been talked about many times - but in my case i really don't know how to start debugging it since i have a component with a lot of subscriptions and i can't trace it's source... any help will do.

I'm using catchError for all the subscriptions and i guess it's not that kind of error...

Here is an example of how i'm implementing the subscriptions:

 this.subs.push(this.apiService.isWorkListLayout$.pipe(
  tap(res => {
    this.formSrv.isDoneLoadingApache$.next(false);
    this.isWorkListLayout = res;
  }),
  switchMap(() => this.apiService.userDataForDialog$),
  tap(patientObj => {
    this.patient = patientObj;
  }),
  switchMap(() => this.isWorkListLayout ? this.apiService.getUsersComponentsData(this.patient) : EMPTY),
  catchError((err) => {
    throw 'Error in source. Details: ' + err;
  })
).subscribe((response) => {
  if (!!response && _.has(response, 'components')) {
    this.filterForm.reset();
    this.setPlaceHolderToFields(response.components, true);

    const formModeData = {
      areEditable: true,
      shouldApacheScoreCalc: true,
    };
    this.formSrv.isDoneLoadingApache$.next(true);
    this.formSrv.setFormMode(this.filterForm, formModeData);
  }
}));

enter image description here

Upvotes: 0

Views: 185

Answers (1)

daflodedeing
daflodedeing

Reputation: 361

Maybe there is a http interceptor that returns undefined in some cases. I just looked at the issue here: https://github.com/ngx-translate/core/issues/1113#issuecomment-614616925

Do you use any interceptors?

Upvotes: 1

Related Questions