-
Notifications
You must be signed in to change notification settings - Fork 78
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
postorgcreate emitted twice - first hook is emitted without await #1700
Comments
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. |
I raised this over here as well: https://github.com/forcedotcom/sfdx-core/issues/634, but doesn't look like it's getting much action. |
This issue has been linked to a new work item: W-11724770 |
@mshanemc can this be closed now? |
This was fixed in sfdx v7.169.1, see release notes: https://github.com/forcedotcom/cli/tree/main/releasenotes/sfdx#71691-sept-22-2022-stable |
Hi all - I'm going to open another issue for this. The postorgcreate event will not fire at all anymore, as the lifecycleEventNames prop has been removed (here: salesforcecli/plugin-org#391) which means no listeners are registered for the postorgcreate event (and hence don't fire the hooks). The emit in the core lib will have no effect (unless you've hooked into the lifecycle and added your own listener). |
Summary
This is specific to version 3.x in conjunction with the org plugin. The org plugin will ultimately call the core method scratchOrgCreate (in the org/scratchOrgCreate module). The scratchOrgCreate method will call emitPostOrgCreate (from org/scratchOrgLifecycleEvents) which emits the lifecycle event
postorgcreate
- this is emitted without an await (so it's properly async). The issue is that the org plugin also emits the lifecycle eventpostorgcreate
, so we're effectively getting the hook firing twice, with the first invocation effectively being in parallel with the second.Here are the code links to the two firings:
https://github.com/salesforcecli/plugin-org/blob/fbbcaf5d816c9e0e6040a2d5cb6690cdb6356674/src/commands/force/org/create.ts#L320
https://github.com/forcedotcom/sfdx-core/blob/050d7c5a7f49b85895c74422ebbb0494fcf0cb96/src/org/scratchOrgCreate.ts#L178
Steps To Reproduce:
Expected result
A specific
postorgcreate
hook should only fire onceActual result
The specific
postorgcreate
hook fires twiceSystem Information
zsh
sfdx
sfdx version --verbose --json
sf
sf version --verbose --json
{
"cliVersion": "sfdx-cli/7.166.1",
"architecture": "darwin-x64",
"nodeVersion": "node-v16.14.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 1.3.0 (core)",
"@oclif/plugin-commands 2.2.0 (core)",
"@oclif/plugin-help 5.1.12 (core)",
"@oclif/plugin-not-found 2.3.1 (core)",
"@oclif/plugin-plugins 2.1.0 (core)",
"@oclif/plugin-update 3.0.0 (core)",
"@oclif/plugin-version 1.1.2 (core)",
"@oclif/plugin-warn-if-update-available 2.0.4 (core)",
"@oclif/plugin-which 2.1.0 (core)",
"alias 2.1.0 (core)",
"apex 1.2.0 (core)",
"auth 2.2.3 (core)",
"community 2.0.1 (core)",
"config 1.4.17 (core)",
"custom-metadata 2.0.0 (core)",
"data 2.1.2 (core)",
"generator 2.0.2 (core)",
"info 2.0.1 (core)",
"limits 2.0.1 (core)",
"org 2.2.0 (core)",
"packaging 1.5.1 (core)",
"schema 2.1.1 (core)",
"signups 1.2.0 (core)",
"source 2.0.13 (core)",
"telemetry 2.0.0 (core)",
"templates 55.1.0 (core)",
"trust 2.0.3 (core)",
"user 2.1.0 (core)",
"@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)",
"salesforce-alm 54.8.1 (core)",
"sfdx-bfs-plugin 2.1.0 (link) /usr/local/lib/node_modules/sfdx-bfs-plugin"
],
"osVersion": "Darwin 21.6.0",
"shell": "zsh",
"rootPath": "/usr/local/lib/node_modules/sfdx-cli"
}
The text was updated successfully, but these errors were encountered: