-
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
@salesforce/cli : JWT Authentication Flow prevents the creation of test users in scratch org #2479
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'm curious about this Are you dynamically modifying the scratchDef file for each orgID to maintain uniqueness?? Do you know about the ok, now back to your problem.
|
Hi Shane, Yes we are generating the username so we could definitely make use of the To your first point - when we use the web authentication flow we can create our scratch org and test users without any issues. Unfortunately, as these commands are used on our CI/CD pipeline, JWT is our only alternative way of authenticating at the moment. To your second point - unless I have made a mistake, we should be creating a user by connecting as the Finally, this is a pre-existing setup i.e. it has been working well until the start of this week. We have a call in to Salesforce to clarify what has changed. |
Just to clarify, we think that our LMO was moved to Hyperforce (GB) over the weekend. Would this have an effect on the above problem? |
possibly. Did your problems not start until today? Asking because there was an incident today with hyperforce orgs https://status.salesforce.com/generalmessages/1212?locale=en-US. |
The issue started Monday. |
WE are having exactly same issue in the CI/CD Pipeline. With slight difference to the opening post. It is happening for at least a couple months. EDIT: details about our setup We are also using sfdx, as we did not yet moved to the sf. Some of our devs, including me, are using sf already, and the script, when run locally, behaves in a same way. You can notice that not all commands are aligned, I am aware, it is work in progress. Connect to DEVHUB
Create scratch
Create User
The Error when creating the user
sf version --verbose --json
|
I think this is related. We cannot create scratch orgs on 2.9.8 if we first authenticate to our devhub using jwt flow. Trying authentication to our devhub via auth-url seemed to work ( at least more consistently ) |
This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted. |
We are currently pursuing this with Salesforce support, however, we are currently using a workaround that entails:
This appears to work and all test users are created successfully. We are trying it over the course of the week and at the moment we haven't had any problems. |
After talking to SF support, they have accepted that there is an issue with the JWT bearer flow when recreating the above scenario on Hyperforce orgs. They will also be raising a documentation bug so that the JWT bearer flow help pages can be updated with a caveat on this. No fix date has been given at the moment. |
This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted. |
Closing as a workaround has been provided while SF fix the issue |
@waterfif Has anything come of this? Have you seen the bug get fixed (e.g. on a later SF CLI version) or documented by Salesforce anywhere? |
@b-bowers nothing as yet I'm afraid. Although they accepted that this was an issue they were less specific about at what point the issue would be fixed. Looking on the JWT Bearer Token Flow docs it hasn't even made it to there yet. We are continuing to use the work around using sfdxurl shown above and this appears to work well in a CI / CD context. |
FWIW, this issue fixed itself as suddenly as it appeared. After about 12 hours of consistent failures on 11/14-11/15, this error went away by itself - no changes to our SF orgs or CI config. |
@b-bowers thanks for the update. Our issue appeared to correlate with the move to Hyperforce (UK) over a weekend. The same commands that worked before the weekend, didn't work after and the only change was our move to Hyperforce. Were you notified that your source org was moving to Hyperforce? It may be nothing to do with it but that was our experience. |
@waterfif our issue started about 2 weeks after our Hyperforce (US) migration. |
We are still seeing this issue currently and we are also on hyperforce. #2575 The known issue is marked as "working as intended" so not sure if Salesforce will actually fix this Note The work around listed here will only work if the Connected App is setup not to expire sessions or refresh tokens. Otherwise, CI/CD would fail whenever those are set to expire. Which may be a security consideration |
@nwcm the security issue is still a concern for us and we may attempt to switch back to JWT soon once we have confidence that the issue is fixed. When talking to Salesforce Support - they attempted to give us the "Working As Expected" explanation but we pushed back on that as it clearly is not. JWT auth worked one day and the same commands did not work the next. |
@waterfif @mshanemc ... This issue is happening again when we try to create a user .. Any suggestion or work around will be really useful |
Looks like the error message has now changed to reflect the JWT restriction when creating users in Hyperforce JwtHyperforceError: This command doesn't work when authorizing an org using the JWT flow if the org is on Hyperforce. |
Best option I can think of, while I'm discovering this issue myself today too Subs... The issue I'm having, as far as I can tell is the same. In my javascript that connects to SF using
I found this comment from mshanemc on a similar thread that also suggests my hunch as a workaround... Comment here from @mshanemc #2575 (comment) Hopefully this helps anyone else struggling to understand and "solve" this issue. |
Summary
As part of our CI/CD pipeline we are experiencing issues creating users on a scratch org created using the JWT authentication flow.
The 3 basic steps involved in this process are:
Steps To Reproduce
sf login org jwt --username "${DEV_HUB_USERNAME}" --jwt-key-file config/server.key --set-default-dev-hub --alias DevHub --client-id "${CLIENT_ID}" --json
Output:
sf org create scratch --set-default --definition-file "config/project-scratch-def.json" --alias usrtst --duration-days 1 --wait 10 --target-dev-hub DevHub --json
Project Definition File (config/project-scratch-def.json):
Output:
Andy Miller
:sf org create user --set-alias amiller --definition-file ./setup/user-defs/amiller.json --target-org usrtst --json
User Definition File (setup/user-defs/amiller.json):
Output:
Expected result
A user called Andy Miller is created in the
usrtst
scratch org and can be retrieved via the salesforce cli using the commandsf org list users
Actual result
A user called Andy Miller is created in the
usrtst
scratch org but the JWT error appears to prevent any further retrieval of the user using the cli.System Information
Shell
git bash
sf version --verbose --json
Additional information
The text was updated successfully, but these errors were encountered: