cli icon indicating copy to clipboard operation
cli copied to clipboard

force:source:push removes entire static resource when single file removed in zipped static resource

Open filiprafalowicz opened this issue 2 years ago • 4 comments

Summary

When I try remove single file from static resource with content type = application/zip and run sfdx force:source:push then entire static resource is being removed from the org.

Steps To Reproduce:

  1. Create following files:
  • force-app/main/default/staticresources/ZippedResource.resource-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">
    <cacheControl>Public</cacheControl>
    <contentType>application/zip</contentType>
</StaticResource>
  • force-app/main/default/staticresources/ZippedResource/file1.json
{}
  • force-app/main/default/staticresources/ZippedResource/file2.json
{}
  1. Run sfdx force:source:push. Static Resource will be pushed successfully with both files.
  2. Delete one of the files in force-app/main/default/staticresources/ZippedResource directory.
  3. Run sfdx force:source:push again.

Expected result

Only file that was removed from the directory should be removed from the zipped resource in the org.

Actual result

Command output suggest that there was only that one file deleted, but if you go to your scratch org you will notice entire static resource was removed.

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.) bash
  • If you are using sfdx
    • Run sfdx version --verbose --json
  • If you are using sf
    • Run sf version AND sf plugins --core
  • Paste the output here
{
        "cliVersion": "sfdx-cli/7.156.1",
        "architecture": "darwin-x64",
        "nodeVersion": "node-v16.15.1",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.3.1 (core)",
                "@oclif/plugin-not-found 1.2.6 (core)",
                "@oclif/plugin-plugins 1.10.11 (core)",
                "@oclif/plugin-update 1.5.0 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
                "@oclif/plugin-which 1.0.4 (core)",
                "@salesforce/lwc-dev-server 2.11.0",
                "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
                "alias 2.1.0 (core)",
                "apex 0.13.0 (core)",
                "auth 2.2.0 (core)",
                "community 2.0.0 (core)",
                "config 1.4.12 (core)",
                "custom-metadata 2.0.0 (core)",
                "data 2.0.4 (core)",
                "generator 2.0.1 (core)",
                "info 2.0.1 (core)",
                "limits 2.0.1 (core)",
                "org 1.13.2 (core)",
                "salesforce-alm 54.6.0 (core)",
                "schema 2.1.1 (core)",
                "sfdx-cli 7.156.1 (core)",
                "signups 1.2.0 (core)",
                "source 2.0.2 (core)",
                "telemetry 2.0.0 (core)",
                "templates 55.0.0 (core)",
                "trust 2.0.0 (core)",
                "user 2.1.0 (core)"
        ],
        "osVersion": "Darwin 21.5.0"
}

Additional information

The same works fine with force:source:legacy:push.

filiprafalowicz avatar Jun 24 '22 11:06 filiprafalowicz

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] avatar Jun 24 '22 11:06 github-actions[bot]

This issue has been linked to a new work item: W-11385865

git2gus[bot] avatar Jul 05 '22 19:07 git2gus[bot]

I am hitting this also, the static resource is referenced so the entire source:push is being blocked saying you aren't allowed to delete the static resource even though I am simply removing one file from inside it (an update)

yippie avatar Jul 21 '22 14:07 yippie

Any update or ETA on W-11385865

This issue appears to completely nuke your scratch org with no way to resolve it. You get the following error over and over with no way to resolve:

This static resource is referenced elsewhere in salesforce.com. Remove the usage and try again. : Lightning Web Component Bundle "c:setup" - MODULE - setup. This static resource is referenced elsewhere in salesforce.com. Remove the usage and try again. : Lightning Web Component Bundle "c:barcodeScanner" - MODULE - barcodeScanner. This static resource is referenced elsewhere in salesforce.com. Remove the usage and try again. : Lightning Web Component Bundle "c:csvToRecords" - MODULE - csvToRecords. This static resource is referenced elsewhere in salesforce.com. Remove the usage and try again. : Lightning Web Component Bundle "c:visualSelectEditor" - MODULE - visualSelectEditor. This static resource is referenced elsewhere in salesforce.c

tehnrd avatar Sep 16 '22 00:09 tehnrd

HI @TehNrd @yippie @filiprafalowicz - the fix has been merged and will be available with Thursday's latest-rc build, sorry it took so long

WillieRuemmele avatar Nov 22 '22 20:11 WillieRuemmele