SharePoint / SharePoint/sp-dev-docs

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

Open
#10,374 3 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Aug 20, 2025.

Needs: Author Feedback sharepoint-developer-support type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

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
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.