Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 17, 2025

  • Explored repository structure and located relevant files
  • Built project successfully to verify baseline
  • Implement CSPConfig error detection and improved error handling in AddApp.cs
  • Implement CSPConfig error detection and improved error handling in PublishApp.cs
  • Test the changes (build succeeded)
  • Address code review feedback
    • Wrapped cleanup operation in try-catch to prevent masking original error
    • Changed from generic Exception to InvalidOperationException for semantic clarity
    • Refined cleanup exception handling to catch only ServerException and ClientRequestException
  • Final validation and build verification complete
  • Added changelog entry referencing PR Add improved error handling for CSPConfig limit errors in Add-PnPApp and Publish-PnPApp #5120

All changes implemented and tested successfully!

Original prompt

This section details on the original issue you should resolve

<issue_title>Failed to deploy SPFx with PS Add-PnPApp - getting error Value of: [CSPConfig] cannot exceed: [100000]</issue_title>
<issue_description>It's not possible to deploy an SPFx to the site collection App catalog when the number of Trusted Script Sources in Content Security Policy is too large (in our case, it was 582).
It doesn't work with Add-PnPApp (Add-PnPApp -Path ./myapp.sppkg -Scope Site -Publish)
or with ALM PnP. => The app is added to the Site Collection App Catalog, but the status remains Deployed = No.
The error is - "Value of: [CSPConfig] cannot exceed: [100000]."

I would expect that command to work well in the scope of site collection. It should not take into account script sources from other site collections. (Trusted Script Sources on tenant level)

I'm using Windows operating system with PSVersion 7.5.3 and PnP.PowerShell 3.1.0 version.

Please check also related issues - SharePoint/sp-dev-docs#10412, SharePoint/sp-dev-docs#10369

</issue_description>

<agent_instructions>Can you try fixing this?</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #5112


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Fix deployment error for SPFx with Add-PnPApp Add improved error handling for CSPConfig limit errors in Add-PnPApp and Publish-PnPApp Oct 17, 2025
@Copilot Copilot AI requested a review from KoenZomers October 17, 2025 09:10
Copilot finished work on behalf of KoenZomers October 17, 2025 09:10
@KoenZomers
Copy link
Collaborator

@copilot Add a changelog entry referencing PR #5120

Copy link
Contributor Author

Copilot AI commented Oct 17, 2025

@copilot Add a changelog entry referencing PR #5120

Added changelog entry in commit 6f1b8dd

@Copilot Copilot AI requested a review from KoenZomers October 17, 2025 13:05
Copilot finished work on behalf of KoenZomers October 17, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to deploy SPFx with PS Add-PnPApp - getting error Value of: [CSPConfig] cannot exceed: [100000]

2 participants