sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Unable to create folders in document library after deploying SPFx Extension that loads javascript file (10357 is unresolved)

Open dmahendranme opened this issue 1 year ago • 5 comments

Target SharePoint environment

SharePoint Online

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

💥 SharePoint Framework

Developer environment

Windows

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

  • [x] 💥 Internet Explorer
  • [x] 💥 Microsoft Edge
  • [x] 💥 Google Chrome
  • [x] 💥 FireFox
  • [x] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

No response

Describe the bug / error

We have a analytics tool that requires javascript file to be called. Created SPFx extension (App Customizer) to load the javascript file. Used SPComponentLoader.loadScript method to load a javascript file present in a site's style library.

javascript file has analytics code.

All SharePoint pages loads fine and everything is tracked in our analytics tool. I'm able to create documents in the library but i'm unable to create a folder.

This is duplicate of 10357 as it is closed with no solution

Response from the contributor shows that contributor did not understand the issue completely. I have responded to contributor's reply in 10357. Please check.

Refer the issue screenshots from 10357

Steps to reproduce

  1. Create SPFx extension -> Application customizer
public onInit(): Promise<void> {
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);

const userName = this.context.pageContext.user.displayName;
(window as any).someconfig = {
  userName: userName
};
SPComponentLoader.loadScript('/Style%20Library/<javascript_snippet_file>.js');
return Promise.resolve();
  1. Deploy the solution and select "Make this solution available to all sites....."
  2. Navigate to any document library
  3. Create a folder

Expected behavior

You will receive "Illegal invocation" error on both console and UI

dmahendranme avatar Aug 19 '25 16:08 dmahendranme

Hello @dmahendranme, Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.

Ashlesha-MSFT avatar Aug 20 '25 04:08 Ashlesha-MSFT

@dmahendranme, Thanks for your detailed follow-up on the issue related to folder creation in document libraries after deploying your SPFx extension. We understand that the issue was closed earlier under #10357, but it seems your clarification (hardcoded JS source, analytics working fine, but folder creation failing) was not fully considered.

We’ve reached out to the engineering team again with your updated context for a second look.

Ashlesha-MSFT avatar Aug 20 '25 07:08 Ashlesha-MSFT

@dmahendranme - the issue is following: when we embed a custom JavaScript file to SharePoint, folder creation starts no longer working with script exception.

This means that the included external JavaScript file contains something which is then overlapping with the out of the box scripts - most likely they are using or overriding same global variable or function, which then causes the exception.

Based on your description - it's clear that the embedded/included custom JavaScript file is causing this - so only way we can provide any input on that - would be to see the content of that file. Even then - it would get tricky for us to do step-by-step script debugging, which we do not provide as a service as such.

Can you double check the used external JavaScript file and see if there's anything obvious it's overriding in it's code. Hopefully that gets you unblocked on the issue.

VesaJuvonen avatar Sep 02 '25 09:09 VesaJuvonen

This issue is more than 12 months old and has not had recent activity. We are cleaning up the backlog so we can manage incoming reports more efficiently. If the issue is still relevant, please submit a new issue with updated details and current reproduction steps. We apologize for any inconvenience caused by this updated process, and thank you for being part of the SharePoint developer ecosystem.

VesaJuvonen avatar Nov 03 '26 10:11 VesaJuvonen

Thank you for taking the time to file an issue. We periodically archive older or inactive issues as part of our issue management process, which automatically closes them once they are archived.

If you’d like to understand more about why and how we handle archived (closed) issues, please see Our approach to closed issues.

We appreciate your contribution and if this is still an active issue with the latest SPFx versions, please do resubmit the details. We needed to perform a cleanup, so that we can start with a clean table with a new process. We apologize for the inconvenience this might cause.

github-actions[bot] avatar Nov 03 '26 10:11 github-actions[bot]