Forum Discussion

aderanths's avatar
aderanths
Copper Contributor
Jan 08, 2024

Issue with SPFx part and OOTB Parts in WebView mode

I've discovered that recently, there appears to be a break introduced when viewing SharePoint modern pages with the parameter of env set to WebView(case-sensitive), e.g /SitesPages/Home.aspx?env=WebView

 

I have to different tenants, which presumably have similar versions of SPO associated with them, but in one environment, I cannot display a Custom SPFx part, whereas the other, it does display. The underlying code for the SPFx part is identical in each case.

 

When attempting to render the SPFx part in the environment where it doesn't work, the following error is visible in the developer tools:

 

Uncaught (in promise) Error: No callbackHandler found.
at e.sendMessage (sp-pages-assembly_en-us_763c3cb5e5e8ad1d42d26be71a7d7293.js:79:1269499)
at sp-pages-assembly_en-us_763c3cb5e5e8ad1d42d26be71a7d7293.js:79:1628439

 

In my SPFx part, I can see that the render function is called, but the promise for that render event is never fulfilled, causing the operation to die without any additional indication of a problem.

 

I've also tested OOTB parts, and determined that the Microsoft Forms part is also not working in the same environment where this is broken, but is functional in the environment where the custom SPFx part is working.

 

Please note, there are other tenants where appears to be a rolling change where the break shows up.

  • AKR_K's avatar
    AKR_K
    Copper Contributor

    The issue is with query parameters ?env=WebView and ?env=WebListView. But where as the Graph API calls working with ?env=Embedded. Still facing some issues with SPFx components load at times. Not sure microsoft have got some resolution or official documentation for this yet.

  • JoeBlueml's avatar
    JoeBlueml
    Copper Contributor
    I have the same issue and figured out, that this only happens, if I perform a MS Graph-call consuming the MSGraphClientFactory (in my case).

    Apparently - when the "env"-parameter "WebView" is present - the promise of each MS Graph-call never gets resolved...
    If you "await" the Graph-call, WebPart execution will break at this point. If you do not "await" the Graph-call and use .then and .catch instead, neither of them will be called...

    Don't know, how to overcome this...

Resources