[BUG] execute reports automations as executed although Marketing Cloud did not start a run (automation never ran before)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- devtools
Research direction
Start in lib/metadataTypes/Automation.js, especially Automation.execute(), and trace how SOAP Perform responses become executedKeyArr entries. Review the public REST automation read and the proposed run status fields, then inspect or add tests with REST fixtures for both a started run and an accepted request with no run. Done means mcdev counts only confirmed starts as executed and warns when Marketing Cloud accepts the request but no run begins.
Written by the indexing model from the issue text.
Description
Describe the bug
mcdev execute -m automation:<key> reports the automation as executed, but Marketing Cloud does not start a run when the automation has never run before. Nothing shows up in the run log, and mcdev prints success.
Tested live on a test business unit with mcdev 10.3.1:
- Deployed a new scheduled automation (status
PausedSchedule, one data extract step) withmcdev deploy -m automation:probe-exec-fresh. - Ran
mcdev execute -m automation:probe-exec-freshright away, and again 2 minutes later.- Both times mcdev logged
- executed automation: probe-exec-freshandExecuted 1 of 1 items. - Automation Studio still showed "This automation has not run" (checked after more than a minute, page reloaded). REST
GET /automation/v1/automations/{id}still returnedstatus: PausedScheduleand nolastRunTime.
- Both times mcdev logged
- Started the automation once in Automation Studio (Run Once > Select All Activities > Run > Run Now). It ran.
- Ran
mcdev execute -m automation:probe-exec-freshagain: this time a run started at once (status Running, then Complete).
The same happened with a four-step automation (data extract, two file transfers, import): the first mcdev execute 13 seconds after the deploy did nothing; after one Run Once in the UI, mcdev execute started a run immediately.
What mcdev sends and gets back
Automation.execute() sends the documented SOAP call (Perform on the Automation object):
<PerformRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Action>start</Action>
<Definitions><Definition xsi:type="Automation"><ObjectID>{automation id}</ObjectID></Definition></Definitions>
</PerformRequestMsg>
Response for the never-run automation (identical to a working call):
<PerformResponseMsg>
<Results><Result><StatusCode>OK</StatusCode></Result></Results>
<OverallStatus>OK</OverallStatus><OverallStatusMessage />
</PerformResponseMsg>
mcdev counts every item with OverallStatus === 'OK' as executed, so the ignored start is reported as a success.
For comparison, the Automation Studio UI's Run Once sends POST /automation/v1/automations/{id}/actions/start with the selected step activities ({"steps":[{"activities":[{"id":"…","IsIncludedInRun":true}]}]}) and gets 201 "Automation Started Successfully". That endpoint is not in the public API documentation, so this ticket does not propose switching to it.
Related, already known: an automation created via REST without a starting source makes the same SOAP Perform start fail with Exception occurred during [PerformOptionStart]; mcdev reports that one correctly as not executed.
Expected behavior
- mcdev only reports an automation as executed when a run actually started.
- If Marketing Cloud accepted the request but no run started, mcdev logs a clear warning, for example: "Marketing Cloud accepted the start request for automation 'x' but did not start a run. Automations that have never run must be started once in Automation Studio (Run Once) before mcdev execute can start them."
Proposed fix
In Automation.execute() (lib/metadataTypes/Automation.js), after a Perform response with OverallStatus OK:
- Read the automation via
GET /automation/v1/automations/{id}(public API) and check whether a run started:statusis Running (statusId 3), orlastRunInstanceId/lastRunTimechanged compared with a read taken before the Perform call. Retry a few times over a few seconds, because the run can take a moment to appear. - If no run started, log the warning above and leave the key out of the returned
executedKeyArr, soExecuted x of y itemsis correct. - Optional: if the pre-Perform read already shows no
lastRunTime, warn up front that the automation has never run.
Add tests for both cases (run started / no run started) with the matching REST fixtures.
Version
10.3.1
- Dominant language
- JavaScript
- Stars
- 166
- Forks
- 50
- Avg merge
- 11h 4m
- Merged PRs (30d)
- 36
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Accenture/sfmc-devtools
-
e/DevOps enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Accenture/sfmc-devtools#2795 ·
Maintainers usually reply within 1 day
-
c/INIT chore
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Accenture/sfmc-devtools#2793 ·
Maintainers usually reply within 1 day
-
bug c/Generic validationRule
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Accenture/sfmc-devtools#2794 ·
Maintainers usually reply within 1 day
-
[FEATURE] transactionalPush: check options.customKeys against the app before deployPossibly taken @orshih6 claimed this 8 days ago. Openc/mobilePushApp c/transactionalPush enhancement
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Accenture/sfmc-devtools#2735 ·
Maintainers usually reply within 1 day
-
c/mobileMessage c/mobilePush c/transactionalPush c/transactionalSms enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Accenture/sfmc-devtools#2733 ·
Maintainers usually reply within 1 day
All issues in Accenture/sfmc-devtools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Life-Framework/Life-Framework#7017 ·
Maintainers usually reply within 1 day
-
agent/guide documentation help wanted stage/010-actionable
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
kubestellar/console-kb#4003 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FilOzone/synapse-sdk#1201 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue task
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NSC-Tech-Hub/nscth-static-website#107 ·
Maintainers usually reply within 1 day