forcedotcom / SFDX-Data-Move-Utility

SFDMU is a cutting-edge Salesforce data migration tool for seamless org population from other orgs or CSV files. It handles all CRUD operations on multiple related objects in one go.
BSD 3-Clause "New" or "Revised" License
444 stars 73 forks source link

[BUG] - Not able to insert data in PROD environment: "the action is not permitted" #777

Closed petter-eikeland closed 3 months ago

petter-eikeland commented 3 months ago

Describe the bug Trying to insert data in PROD. Getting [ERROR] Execution of the command has aborted by the user. The action is not permitted. I'm not getting this error when running the same command with the same CSV data towards Sandbox Environments.

To Reproduce

  1. Create CSV file of data to insert + export.json
  2. Execute sf sfdmu run -s csvfile -u [PROD-alias] -p path/to/csvfile --noprompt I have also tried to run with -c true and -c 1, and without --noprompt and manually giving confirmation

Expected behavior Data inserted

Actual Behavior

[10:50:05.210] Execution of the command sfdmu:run has been started.
=== Loading and validating the export.json script ...

=== OBJECT SET #1 STARTED

Running Plugin version: 4.33.17
Running Add-On API version: 1.5.0
[10:50:05.217] Loading Core Add-On Module declarations ...
[10:50:05.251] Connecting to the PROD using SFDX sf org display ...
 ›   Warning: @salesforce/cli update available from 2.34.7 to 2.42.6.
[10:50:07.54] Successfully connected to the PROD.
[10:50:07.241] [10:50:07.240] NOTE! The Plugin has detected that you are about to modify the Production org.
To confirm that you really want to modify this org, please type:  prod.my.salesforce.com ?  y
Command in progress... done

[10:50:07.242] [ERROR] Execution of the command has aborted by the user. The action is not permitted.
[10:50:07.244] [ERROR] Execution of the command sfdmu:run has been completed. Exit code 5 (COMMAND_ABORTED_BY_USER).
[10:50:07.244] Total time elapsed: 00h 00m 02s 033ms .

export.json

{
    "objects": [
        {
            "query": "SELECT Name, PostalCode__c,City__c,StateCode__c,ActivityDate__c,MunicipalityCode__c,SurrogateId__c FROM PostalCode__c",
            "externalId": "SurrogateId__c",
            "operation": "Upsert"
        }
    ]
}

Log file


 [10:50:05.210] Execution of the command sfdmu:run has been started.
 [10:50:05.211] newLine
 LOADING AND VALIDATING THE EXPORT.JSON SCRIPT ...
 [10:50:05.215] newLine
 OBJECT SET #1 STARTED
 [10:50:05.215] newLine
 {
   "Running Plugin version": "4.33.17"
}
 {
   "Running Add-On API version": "1.5.0"
}
 [10:50:05.217] newLine
 [10:50:05.217] Loading Core Add-On Module declarations ...
 [10:50:05.251] Connecting to the PROD using SFDX sf org display ...
 [10:50:07.54] Successfully connected to the PROD.
 [10:50:07.241] [10:50:07.240] NOTE! The Plugin has detected that you are about to modify the Production org.
To confirm that you really want to modify this org, please type:  prod.my.salesforce.com ?  y

 [10:50:07.242] [ERROR] Execution of the command has aborted by the user. The action is not permitted.
 [10:50:07.244] [ERROR] Execution of the command sfdmu:run has been completed. Exit code 5 (COMMAND_ABORTED_BY_USER).
 [10:50:07.244] Total time elapsed: 00h 00m 02s 033ms .

_target.csv file. None are generated

Added sample csvfile for insert:

Name,PostalCode__c,City__c,StateCode__c,ActivityDate__c,MunicipalityCode__c,SurrogateId__c
9141,9141,Mjølvik,54,2020-01-06,5401,1
hknokh commented 3 months ago

Hello, @petter-eikeland

Thank you for reporting a bug. I will take a look at it as soon as possible and let you know of any updates.

Cheers

hknokh2 commented 3 months ago

Hello To protect the production data you have to respond to the prompt or to add this flag to your command: https://help.sfdmu.com/running#--canmodify--c --noprompt is ignored in this case

petter-eikeland commented 3 months ago

Hi @hknokh,

Thanks for your response. As mentioned above, I have also tried to run the command with and without the -c flag, but I am getting the same error:

➜  PROD git:(issue/sfdmu-bug) ✗ sf sfdmu run -s csvfile -u PROD -p src/postal-registry-data --canmodify true
(node:22865) Warning: Deprecated config name: apiVersion. Please use org-api-version instead.
(Use `node --trace-warnings ...` to show where the warning was created)
[05:55:16.852] Execution of the command sfdmu:run has been started.
=== Loading and validating the export.json script ...

=== OBJECT SET #1 STARTED

Running Plugin version: 4.33.17
Running Add-On API version: 1.5.0
[05:55:16.859] Loading Core Add-On Module declarations ...
[05:55:16.892] Connecting to the PROD using SFDX sf org display ...
 ›   Warning: @salesforce/cli update available from 2.34.7 to 2.43.7.
[05:55:19.987] Successfully connected to the PROD.
Command in progress... done
[05:55:20.165] NOTE! The Plugin has detected that you are about to modify the Production org.
To confirm that you really want to modify this org, please type:  prod.my.salesforce.com ? : y
Command in progress... done

[05:55:24.603] [ERROR] Execution of the command has aborted by the user. The action is not permitted.
[05:55:24.607] [ERROR] Execution of the command sfdmu:run has been completed. Exit code 5 (COMMAND_ABORTED_BY_USER).
[05:55:24.608] Total time elapsed: 00h 00m 07s 751ms .
hknokh2 commented 3 months ago

Your usage of the canmodify is incorrect. You should put prod org instance name after this flag: --canmodify my.instance.name.salesforce.com Please see the details in the referenced article

petter-eikeland commented 3 months ago

Aha, thank you @hknokh2 (do you have 2 users??)!

Now I understand. When executing sf sfdmu run -s csvfile -u PROD -p src/postal-registry-data -c prod.my.salesforce.com it runs successfully

hknokh2 commented 3 months ago

Yes I have 2 users)