SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.01k forks source link

SPFx extension stopped working with no action from our side #8983

Open rpochepovich opened 1 year ago

rpochepovich commented 1 year ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

other (enter in the "Additional environment details" area below)

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

We had a support ticket opened for that issue as follows (please see more information on MS Support findings below the dash line) • Microsoft Support [Case #:36134853] • Created on: Tuesday, April 25, 2023 9:38 AM • Description: We have custom SPFx extension developed and deployed for us by 3rd party vendor, Microsoft Partner. That extension worked as expected for about a year and some time ago stopped working without any actions taken from our side. That extension creates a link in Top Navigation and is supposed to show a drop down of item choices on mouse over. When the Intranet page where extension is hosted loads, DevTols show the following error (the GUID in the error is of the SPFx extension that stopped working and the URL of the sp-pages-assembly_en-us_380255c8e20811346b873b876a9bc242.js:70:1453258 is: https://res-1.cdn.office.net/files/sp-client/sp-pages-assembly_en-us_380255c8e20811346b873b876a9bc242.js ): ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] sp-pages-assembly_en-us_9bb00ad5e643999a6f8283c7d40ebf42.js:70 Uncaught (in promise) Error: Failed to create application customizer 'ClientSideExtension.ApplicationCustomizer.6aa27935-d4df-42d5-a14e-92ef523a05f5'. Error information is 'Extension failed to initialize for componentId "6aa27935-d4df-42d5-a14e-92ef523a05f5".'. at sp-pages-assembly_en-us_9bb00ad5e643999a6f8283c7d40ebf42.js:70:1453258 at async Promise.all (index 0)

Shruti from SharePoint development team (Microsoft Premier Support msprmsup@microsoft.com [Case #:36134853]) spent a lot of time troubleshooting and reproducing the issue in her environment, using code we provided. She built web part and the extension locally. Below is the citation from her latest email describing the status of the issue:

_I had an opportunity to spend multiple days with the copy of your code and get it to build in my lab. I do not see an scss file and that is where the package building fails. Is this the original code packaged and deployed? Apart from that just taking the packaged solution file from your environment does not render the webpart. Now again since the webpart does work for you and it renders alright but only the app customizer throwing the error, at this point it is very good idea to engage directly with our Product Team. It is best not to delay here as I did spend significant time trying to rebuild your solution. I reviewed the code and it looks alright to me. I see we are using pnp here. It is possible something has changed with pnp which could be resulting in this behavior. Pnp is a community support directly supported by our Product Team directly on the Github thread here._

I think it would be useful for you to connect to Shruti for more information as she already has a lot of useful information that would help to find and fix the issue.

Steps to reproduce

1.The extension is supposed to load right on loading our intranet home page, with no additional actions, automatically.

Expected behavior

The sign that extension is working is that on Mouse Over on the My Links link in Hub navigation, the drop down should be displayed with personal links for the current user.

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

hesperanca commented 1 year ago

This looks similar to an issue I've reported: #8970 (localization files causing extensions to fail to load)

rpochepovich commented 1 year ago

I looked at the issue you mentioned, and the only similarity I see is the error message. As I mentioned in the description, it's a very good idea to contact Microsoft Support person Shruti who spent a lot of time investigating and localizing the issue. Microsoft Support [Case #:36134853] I have an agreement with her that she will give you all the information if you contact her. She had a code source and was able to build and reproduce it in her dev environment, so she is able to answer all your questions.

rpochepovich commented 1 year ago

I would like to follow up on the progress of the ticket.

AJIXuMuK commented 1 year ago

@rpochepovich Could you share the solution with me? you can use aterentiev@microsoft.com

rpochepovich commented 1 year ago

Hello, Alex, Could you provide the secure URL to drop off the solution? It would not go through the email. This is how I shared the solution with MS Support person.

Regina Pochepovich Software Engineer SharePoint, IT Northbridge 105 Adelaide Street West | Suite 700 | Toronto, ON | M5H 1P9
 Tel: 416.815.6633 @.**@.>

From: Alex Terentiev @.> Sent: Friday, June 2, 2023 9:29 AM To: SharePoint/sp-dev-docs @.> Cc: Regina Pochepovich @.>; Mention @.> Subject: Re: [SharePoint/sp-dev-docs] SPFx extension stopped working with no action from our side (Issue #8983)

EXTERNAL EMAIL: Do not click any links or open any attachments unless you trust the sender and know the content is safe. COURRIEL EXTERNE : Ne cliquez sur aucun lien ni fichier à moins d’en connaître l’expéditeur et de savoir que le contenu est sûr.

@rpochepovichhttps://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3137617d-454455535732-8532fd214f8cf6bc&q=1&e=32c09dab-a02a-4c7e-946e-56472c1ce38c&u=https%3A%2F%2Fgithub.com%2Frpochepovich Could you share the solution with me? you can use @.**@.>

— Reply to this email directly, view it on GitHubhttps://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3137617d-454455535732-2a1d9136aa03b543&q=1&e=32c09dab-a02a-4c7e-946e-56472c1ce38c&u=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-docs%2Fissues%2F8983%23issuecomment-1573736296, or unsubscribehttps://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3137617d-454455535732-cdb849a5f283bbdc&q=1&e=32c09dab-a02a-4c7e-946e-56472c1ce38c&u=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA75O4TBKWBF3DEQHAZMWRLDXJHTAXANCNFSM6AAAAAAYMCCWBM. You are receiving this because you were mentioned.Message ID: @.***>

rpochepovich commented 1 year ago

ManageMyLinksWebPart (1).zip MyLinksExtension (1).zip

rpochepovich commented 1 year ago

Please confirm you received the source code.

AJIXuMuK commented 1 year ago

@rpochepovich - I downloaded the code, thanks. You have a lot of requests happening in the onInit. And some of them may potentially start failing due to missing/delete information. Could you please debug it on your end, check the network trace and see if the requests for getting list items as well as property bag are returning valid data. I'm not seeing try...catch blocks in your code so any error in onInit will lead to the error you are seeing.

I totally understand it's unfortunate the customizer stopped working but it can be related to the fact of missing data.

hesperanca commented 1 year ago

@rpochepovich - I downloaded the code, thanks. You have a lot of requests happening in the onInit. And some of them may potentially start failing due to missing/delete information. Could you please debug it on your end, check the network trace and see if the requests for getting list items as well as property bag are returning valid data. I'm not seeing try...catch blocks in your code so any error in onInit will lead to the error you are seeing.

I totally understand it's unfortunate the customizer stopped working but it can be related to the fact of missing data.

Hi @AJIXuMuK. Sorry to step in but this is related to your latest answer. Does MS have any best practices on how to handle errors on the onInit method? We were having a debate internally and could not find any info about if we should reject or resolve the promise (return "Promise.Resolve" or "Promise.Reject") and what are the implication of doing so (e.g. if we reject the promise does it cause problems with other components loading on the page?).

Many thanks.

AJIXuMuK commented 1 year ago

@hesperanca - it's a good question. I would say ideal situation for both MS and a developer would be just return resolved promise right away without even waiting for any actual initialization to happen. From MS perspective (and end-user) the page will be loaded faster. For a developer - you can have custom render UI to display during initialization process that will also make an impression of faster web part.

Now, if we go with the real initialization and resolving or rejecting the promise at the end. If you reject the promise - we will render an error for the web part. If you resolve it - we will try to call all other lifecycle events.

Hope that makes sense.

rpochepovich commented 1 year ago

A few notes here. Thank you into looking into the code. The items are returned from the SharePoint list, because the 2nd part of the web part/extension duo has the list items properly. The code was developed for us by Microsoft partner Envision IT, and was working as expected for almost 2 years. As I mentioned, we first opened a ticket with MS Premier Support and Shruti had the issue reproduced and well investigated in her dev environment. She is ready to share her findings. She said she would be happy to talk to you if you reach to her and I think that it's a good idea to do so. The information about MS Support ticket and description of findings are in the issue description.

AJIXuMuK commented 1 year ago

@rpochepovich - sorry, but that is not how this issue list works. If you have a support ticket with Microsoft and the support engineer is sure that product group should take a look, he/she should pass it further in the system with information about all the findings and repro environment. That would be the best path forward.

From what I can recommend (based on the code) is to check

ghost commented 1 year ago

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within the next 7 days of this comment. Please see our wiki for more information: Issue List Labels: Needs Author Feedback & Issue List: No response from the original issue author

rpochepovich commented 1 year ago

We have Hub Navigation in place, the ewb part and extension is on our Intranet home page List is in place and is retrieved properly , the web part that is using it in a separate page, displays all items properly