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

texei:package:dependencies:install command requires DevHub #57

Closed
ImJohnMDaniel opened this issue Apr 1, 2021 · 12 comments
Closed

texei:package:dependencies:install command requires DevHub #57

ImJohnMDaniel opened this issue Apr 1, 2021 · 12 comments
Labels
enhancement New feature or request

Comments

@ImJohnMDaniel
Copy link
Contributor

ImJohnMDaniel commented Apr 1, 2021

I noticed that the texei:package:dependencies:install command requires the DevHub to be specified. Is that really required?

@FabienTaillon, in my version of the command, it was simply because line 41 was set to true. Once I changed that to false, the command worked fine. I am not aware of a need in the Texei version to have access to the DevHub so I wanted to check with you first.

The use case where this becomes an issue is with customer admin teams trying to just deploy packages in bulk but they don't use a DevHub themselves.

Let me know if you have questions.

Cheers!

@FabienTaillon
Copy link
Member

Thanks I'll have a look, but I don't think it's needed. Could be one of these 2 reasons:

  • It was one of my first command, so at the time I may just have kept the default values for a generated command
  • Salesforce install command used under the hood may have required a DevHub at some time, I know some commands have the same kind of issues and have been fixed since then

I'll make sure it's not needed and removed it, thanks for the feedback !

@FabienTaillon
Copy link
Member

@ImJohnMDaniel looks like the DevHub is used here.

I think it's in the case where you define your dependency with a Package Id and a Version Number, instead of a Package Version Id. It then need to query the DevHub to retrieve the corresponding 04t Id.

So if it's you use this:

"dependencies": [ 
   {
      "package": "MyPackageName",
      "versionNumber": "0.1.0.LATEST"
   }
]

instead of this:

"dependencies": [ 
   {
      "package": "MyPackageName@0.1.0.1"
   }
]

I guess we may mostly be using the 2nd notation now as it's easier with aliases, so it could be something from pre-aliases time.
Still if you use the keys package and versionNumber (still supported as described here).

What could be done though is to remove the requirement, and display an error message only in the case of a dependency found with package and versionNumber if no DevHub is set.

Do you think it's worth it ?

@ImJohnMDaniel
Copy link
Contributor Author

Hey @FabienTaillon -- apologies for not circling back with you here, but that is exactly what I remembered. In the end, I did not make the parameter a requirement because it is only relevant if you have a non-pinned dependency setup. I would recommend making the parameter optional with an error message should it be discovered that one of the dependencies in the sfdx-project.json is non-pinned. Thanks for the help!

@FabienTaillon
Copy link
Member

Makes sense, I'll flag this as an enhancement. Thanks for the suggestion.

@FabienTaillon FabienTaillon reopened this Apr 25, 2021
@FabienTaillon FabienTaillon added the enhancement New feature or request label Apr 25, 2021
@arafesthain
Copy link

arafesthain commented Sep 28, 2023

Hello @FabienTaillon
Getting this error since few days : "No default dev hub found. Use -v or --target-dev-hub to specify an environment"

My problem is that I don't want to specify a dev-hub, I just want package installation and nothing more. Any tips to get rid of this ? (moreover our Unlock packages have a lot of Different Dev Hubs so define "One" is not an option for us)

PS: We are using package version id (04t)

@FabienTaillon
Copy link
Member

This is weird because Dev Hub was already required before.

What changed since a few days is our migration to sf V2, that moves --targetdevhubusername to --target-dev-hub flag, but both should still work.

Do you have the whole command you're running please ?

@arafesthain
Copy link

arafesthain commented Sep 28, 2023

Any chance the parameter requiresDevhubUsername can be set on CLI params ? (I imagine that the answer is No as there is no mention in the doc)

sf texei package dependencies install -a package -r -w 30 --target-org $ORG_ALIAS -k "1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:" 2> "$WORKSPACE"/texei_plugin_logs.txt

And here the Auth part for the Org:

sfdx force:auth:jwt:grant --client-id $CONSUMERKEY --username $USERNAME --jwt-key-file $SERVER_KEY_PATH -r $INSTANCE_URL --alias $ORG_ALIAS --json > out.txt

PS: I moved to sf-v2 (previously we were on sfdx only) the whole thing after getting the same error on the old one

So i was getting same error with this one :
sfdx texei:package:dependencies:install -a package -r -w 30 -u $ORG_ALIAS -k "1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:" 2> "$WORKSPACE"/texei_plugin_logs.txt

@FabienTaillon
Copy link
Member

No you can't. I tried and I couldn't reproduce it, I mean, I'm getting the same behavior before the V2 migration and after.
So without a DevHub I don't know why it was working before.

I could update the code to require it only in a specific scenario, but that will take some time to update. Are you sure you did not have any DevHub de setup previously ?

@arafesthain
Copy link

arafesthain commented Sep 28, 2023

To be more precise the first error I got (2 days ago Tuesday 26th of September) from the texei CLI is "Error (1): The specified org CI is not a Dev Hub".
I'm running this exact same pipeline line since 2 years now and never had an error before.
Then from this error I removed in my JWT Auth the "set default env hub" (as clearly my org was not an env hub the error was fair).
But then I got "No default dev hub found. Use -v or --target-dev-hub to specify an environment"

Could you (as a quick workaround) keep the code "as is" (requiresDevhubUsername default to True) and let us set it to False through a new parameter of the CLI? or has an environment variable like for SF CLI e.g :

export SF_USE_GENERIC_UNIX_KEYCHAIN=true
export SF_DOMAIN_RETRY=300

Then as a long term solution, make it required only for specific scenario.

FabienTaillon added a commit that referenced this issue Sep 29, 2023
@FabienTaillon
Copy link
Member

@arafesthain I've removed the Dev Hub as mandatory, and only checking for it when needed, as @ImJohnMDaniel suggested, can you give it a try ?

@arafesthain
Copy link

arafesthain commented Sep 29, 2023

@FabienTaillon thanks a lot! working perfectly 😃
🍾

@FabienTaillon
Copy link
Member

Perfect ! Closing this one then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants