Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sfdx force:source:delete does not work on production orgs #971

Closed
BalajiKshatriy opened this issue Apr 13, 2021 · 9 comments
Closed

sfdx force:source:delete does not work on production orgs #971

BalajiKshatriy opened this issue Apr 13, 2021 · 9 comments
Labels
feature Issue or pull request for a new feature investigating We're actively investigating this issue

Comments

@BalajiKshatriy
Copy link

force:source:delete fails and wouldn't run on production orgs.

Steps to Reproduce:

  • Connect to any production org and attempt to delete any metadata (in this case attempting to delete a custom field)

sfdx force:source:delete -m "CustomField:testobject__c.Admin_Badges__c"

throws error:
{
"status": 1,
"name": "sf:INVALID_OPERATION",
"message": "INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations",
"exitCode": 1,
"commandName": "SourceDeleteCommand"
}

  • As above command failed with testLevel missing error, try providing testlevel and attempt the delete

sfdx force:source:delete -m "CustomField:trailheadapp__Trailhead_User_Data__c.Admin_Badges__c" -l RunLocalTests

throws error:
{
"status": 1,
"name": "Error",
"message": "Unexpected arguments: -l, RunLocalTests\nSee more help with --help",
"exitCode": 1,
"commandName": "SourceDeleteCommand",
"stack": "Error: Unexpected arguments: -l, RunLocalTests
}

tried other possibilities with --checkonly flag etc.. but none help.
tried with latest and greatest cli & plugin version.

Couple other notes:

  1. The documentation from Salesforce is very Vague around this and needs correction as well. It doesn't clearly state whether this is designed to work for production orgs or not.
  2. This command should also take manifest file (package.xml/destructivechanges.xml) to have scalable way to list components to delete. currently it seem like designed to accept only comma separated metadata components which is not viable.
@BalajiKshatriy BalajiKshatriy added the investigating We're actively investigating this issue label Apr 13, 2021
@github-actions
Copy link

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.

@peternhale peternhale added the feature Issue or pull request for a new feature label Apr 14, 2021
@github-actions
Copy link

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.

@uip-robot-zz
Copy link

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

@github-actions
Copy link

Thank you for filing this feature request. We appreciate your feedback and will review the feature at our next grooming or sprint planning session. We prioritize feature requests with more upvotes and comments.

@fransf-wtax
Copy link

fransf-wtax commented Jul 1, 2021

@forcedotcom Any update here? We don't have visibility on work items.

@shetzel
Copy link
Contributor

shetzel commented Jul 1, 2021

@fransf-wtax - We first want to promote the source plugin to the production CLI core plugins. Once that work is complete the next scheduled work will be to add the source delete command to it, but also to support destructive changes as part of a source:deploy. My guess is it will be delivered in late July or early August.

@cristiand391
Copy link
Member

This was fixed in latest v7.120.0, release notes:
https://github.com/forcedotcom/cli/tree/main/releasenotes#71200-sept-30-2021

@cnwork
Copy link

cnwork commented Dec 29, 2021

This was fixed in latest v7.120.0, release notes: https://github.com/forcedotcom/cli/tree/main/releasenotes#71200-sept-30-2021

Sorry but this still seems to be happening even in the latest release.
Here's my output running sfdx -v
sfdx-cli/7.132.0 wsl-x64 node-v16.13.0

And command with error:
sfdx force:source:delete --sourcepath /home/user/workspace/work/NewProject/Gaming/force-app/main/default/classes/SupportVFTemplateController.cls --noprompt *** Deleting with SOAP API *** ERROR running force:source:delete: INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations

@mariomvp11
Copy link

This was fixed in latest v7.120.0, release notes: https://github.com/forcedotcom/cli/tree/main/releasenotes#71200-sept-30-2021

The error remain unresolved in the latest release:
sfdx-cli/7.201.6 win32-x64 node-v18.15.0

Error:
sfdx force:source:delete --sourcepath c:\Users\mario\Desktop\Workspace\SF Albira PRO\force-app\main\default\lwc\gtagManagerScript --noprompt (node:9344) Warning: Deprecated environment variable: SFDX_JSON_TO_STDOUT. Please use SF_JSON_TO_STDOUT instead. (Use node --trace-warnings ... to show where the warning was created) Warning: The "force source delete" command has been deprecated. Use "project delete source" instead. Warning: The "--sourcepath" flag has been deprecated. Use "--source-dir | -p" instead. Warning: The "--noprompt" flag has been deprecated. Use "--no-prompt | -r" instead. *** Deleting with SOAP API *** Error (1): INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue or pull request for a new feature investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests

8 participants