Premium support for our pure JavaScript UI components


Post by cpritchard »

We have an Angular app that uses Calendar, Scheduler, Gantt and Grid.

Calendar, Scheduler and Gantt are using CrudManager while Grid is using an AjaxStore to fetch data.

We are using Microsoft Azure for authentication with the MSAL library to handle fetching and refreshing authorization tokens and adding them to our Http requests.

It seems that however the Bryntum CrudManager and AjaxStores are executing their fetch calls do not get intercepted by either MSAL's interceptors or any basic HttpInterceptor we implement.

This is problematic because while we can set the authorization header in the CrudManager config, since we cannot simply intercept the outbound request and add it dynamically there, we cannot guarantee that each request will have the latest active token.

Can you advise on how we can implement some sort of HttpInterceptor that can detect the load and sync calls and add the authorization header there?

If you run one of your Angular demos and implement an HttpInterceptor that simply logs the outbound request, you should see this same behavior that nothing is picked up or logged.



Post by cpritchard »

Thank you, I have been able to dynamically add the authorization token using the 'beforeSend' listener.

However, while testing error handling in the event the token is not present or expired, I cannot seem to capture this error when the request and load fails due to a 401 http response from our API Gateway.

Screen Shot 2022-07-06 at 1.49.05 PM.png
Screen Shot 2022-07-06 at 1.49.05 PM.png (206.23 KiB) Viewed 679 times

I am listening to the 'requestFail' event and handling that, as well as capturing the error on the promise with .catch()

Screen Shot 2022-07-06 at 1.49.16 PM.png
Screen Shot 2022-07-06 at 1.49.16 PM.png (75.96 KiB) Viewed 679 times

No matter what I try, this Failed to fetch error always goes to the console as uncaught. Can you offer any insight to how I can capture it and handle it so this does not happen?


Post by tasnim »

Thanks for reporting.
I've reproduced it. We'll check what's wrong! Here is a ticket https://github.com/bryntum/support/issues/4901
Best of luck.


Post by Maxim Gorkovsky »

Hello. Can you try latest nightly build? This should've been fixed as part of this ticket: https://github.com/bryntum/support/issues/4872 When I try this snippet I don't see any unhandled exceptions


Post by cpritchard »

Currently we are on v5.0.6 for all of our Bryntum libraries. Will this fix be released soon in a 5.0.7 or will it be packaged into the 5.1.0 release?


Post by tasnim »

Yes. It will be released in 5.0.7 version. Good Luck.


Post by cpritchard »

Hello, Just an update on this issue.

I saw that v5.0.7 was released last night and I have upgraded our project to use the latest version. The unhandled exception has been resolved, however this is still an Ajax warning in the console that I am unsure if it is intended to always be logged.

For Calendar and Scheduler Pro it is:

Screen Shot 2022-07-13 at 12.55.22 PM.png
Screen Shot 2022-07-13 at 12.55.22 PM.png (142.39 KiB) Viewed 580 times

For Gantt it is:

Screen Shot 2022-07-13 at 12.57.53 PM.png
Screen Shot 2022-07-13 at 12.57.53 PM.png (142.97 KiB) Viewed 580 times

This warning is not present in the console for Grid when the send request fails due to no authorization header.

Can you confirm if this is intended to always be logged or if it should also be getting handled by the .catch() and requestFail handler?


Post by alex.l »

Yes, it will be always logged as warning, no need to catch, it's already handled.

All the best,
Alex


Post Reply