Hi Kiflemariam, You should not cast all things to promises, that makes your life so much harder.
newSetupApp(idToken) { const keyHandler = async key => { if (key) { await this.db.setKey(key).catch(() => console.log('setDb Failed')); await this.db.createData(key).catch(() => console.log('createDb Failed')); } console.log('done with promises'); return key; }; this.apiService .api1(idToken) .pipe( /** only proceed if the result is 'ok */ filter(result => result.includes('ok')), switchMap(() => this.apiService.api2()), /** the whole handling of the api2 result is a side-effect */ switchMap(keyHandler), switchMap(() => this.apiService.api3()) ) .subscribe({ next(result) { console.log('result', result); }, error(err) { console.log('an error occured', err); } }); } Should do what you need. A working version is available on stackblitz <https://stackblitz.com/edit/rxjs-vmrjlr?devtoolsheight=60> If you have any question, don't hesitate to ask -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. To view this discussion on the web visit https://groups.google.com/d/msgid/angular/8d1215e2-be6d-45ee-a302-5126f45c68f9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.