hardisgroupcom / sfdx-hardis

Swiss-army-knife Toolbox for Salesforce. Orchestrates base commands and assist users with interactive wizards to make much more than native sfdx + Allows you to define a complete CI/CD Pipeline and Schedule a daily Metadata backup & monitoring of your orgs
https://sfdx-hardis.cloudity.com
GNU Affero General Public License v3.0
187 stars 32 forks source link

Error when removing obsolete flows #662

Open spw-dhurran opened 1 month ago

spw-dhurran commented 1 month ago

? 🦙 Do you confirm you want to delete these 46 flow versions ? ✅ Yes [sfdx-hardis] Error deleting Flow records:[object Object] SfdxError: Error deleting Flow records:[object Object] at handleCallback (/Users/firstname.lastname/.local/share/sf/node_modules/sfdx-hardis/lib/common/utils/apiUtils.js:122:23) at /Users/firstname.lastname/.local/share/sf/node_modules/sfdx-hardis/node_modules/jsforce/lib/promise.js:76:9 at process.processTicksAndRejections (node:internal/process/task_queues:77:11) { cause: undefined, actions: undefined, exitCode: 1 } ERROR running hardis:org:purge:flow: Cannot read properties of undefined (reading '_toRecordResult') [sfdx-hardis] hardis:org:purge:flow execution time 0:00:44.509

image

Node Version v20.8.0 git version 2.39.3 (Apple Git-146)

spw-dhurran commented 1 month ago

Sorry wrong repo

nvuillam commented 1 month ago

This is the good repo, as this is the command called from VsCode sfdx-hardis :)

I'll have a look :)

nvuillam commented 1 month ago

@spw-dhurran I did not succeed to reproduce the issue

Do you have on all orgs or just a single one ?

The error seems to be with Bulk API:

spw-dhurran commented 1 month ago

Hi @nvuillam, yes it doesn't fail if I try and delete say 5 flows. I have it on all orgs. My colleague also installed and had the same issue, we are both sys admins. I wonder if something is being blocked by the company. When it fails it actually deletes some, then blows up coming back for the next batch. This is a recent thing.

nvuillam commented 4 weeks ago

@spw-dhurran when you say "recent", does it mean "since the beginning of june", or later ?

We published an update to dramatically improve the execution time for the command in https://github.com/hardisgroupcom/sfdx-hardis/pull/617

spw-dhurran commented 4 weeks ago

Hi @nvuillam he installed the start of August, after I had this issue.

nvuillam commented 4 weeks ago

@spw-dhurran please can you have a look in Bulk Data Load Jobs in the setup to check if you see any errors ?

https://help.salesforce.com/s/articleView?id=sf.monitoring_async_api_jobs_details.htm&type=5

spw-dhurran commented 4 weeks ago

Hi @nvuillam I just ran it again, with 14 obsolete flows, no new record in bulk jobs. This is the last one, not me. image

nvuillam commented 4 weeks ago

Lightning URI event is a table from event monitoring, so indeed it's something else...

@masaner did you see such issues when you implemented the refactoring of the command ?

masaner commented 4 weeks ago

Lightning URI event is a table from event monitoring, so indeed it's something else...

@masaner did you see such issues when you implemented the refactoring of the command ?

Hey @nvuillam i did not see any issues while i was doing the refactoring. I did some tests and confirmed that the changes were functioning correctly. I can take another look at it if need be.

nvuillam commented 1 day ago

@spw-dhurran the problem has been declared to jsforce and is in current investigation -> https://github.com/jsforce/jsforce/issues/1571

I added a failsafe that runs the deletion one by one in casse the bulk delete fails: it's longer but it works :)

It will be released in sfdx-hardis v5, but you can already test it using sf plugins install sfdx-hardis@alpha :)

Note: I also added an enhancement that also deletes (after prompting user) the FlowInterviews that would prevent Flow Versions deletions