cli icon indicating copy to clipboard operation
cli copied to clipboard

Command `force:user:create` throws an error but creates the User.

Open javierCTL opened this issue 2 years ago • 6 comments

Summary

Our CI job needs to create a user that we will later use to run our test suite, but we're getting an error even though the user is successfully created:

ERROR running force:user:create:  Error authenticating with the refresh token due to: expired access/refresh token

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Authenticate to a devhub using sfdx force:auth:sfdxurl:store
  2. Authenticate to a scratch org using sfdx auth:accesstoken:store
  3. Create a user in the scratch org using sfdx force:user:create with a definition file.

Expected result

Successfully create the user without throwing an error.

Actual result

Receiving an error although the user is successfully created in the scratch org.

ERROR running force:user:create:  Error authenticating with the refresh token due to: expired access/refresh token

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.)
    • bash (Github Workflows)
{
  "cliVersion": "sfdx-cli/7.164.2",
  "architecture": "linux-x64",
  "nodeVersion": "node-v16.17.0",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.0 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 5.1.[12](https://github.com/CrisisTextLine/salesforce/runs/7975851330?check_suite_focus=true#step:5:13) (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.1 (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.1.0 (core)",
    "auth 2.2.3 (core)",
    "community 2.0.0 (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)",
    "schema 2.1.1 (core)",
    "signups 1.2.0 (core)",
    "source 2.0.12 (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)",
    "texei-sfdx-plugin 1.16.1 (link) /home/runner/work/salesforce/salesforce/node_modules/texei-sfdx-plugin"
  ],
  "osVersion": "Linux 5.[15](https://github.com/CrisisTextLine/salesforce/runs/7975851330?check_suite_focus=true#step:5:16).0-10[17](https://github.com/CrisisTextLine/salesforce/runs/7975851330?check_suite_focus=true#step:5:18)-azure"
}

Additional information

job users

javierCTL avatar Aug 23 '22 14:08 javierCTL

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.

github-actions[bot] avatar Aug 23 '22 14:08 github-actions[bot]

Thanks for the issue @javierCTL, I am going to attempt to reproduce this. Was this working as expected in previous versions of the CLI?

iowillhoit avatar Aug 26 '22 18:08 iowillhoit

Hey @iowillhoit thank you for answering. I'm afraid I can't tell, this is the first time we've tried this combination of commands.

javierCTL avatar Aug 26 '22 19:08 javierCTL

Ok, I was able to replicate this using auth:accesstoken:store. A few things I noticed:

  • It does not seem to matter how you authenticated to the devhub. I am using JWT
  • Tested the scratch org auth with different methods
    • No error with JWT
    • No error with auth:device:login (web)
    • No error with auth:sfdxurl:store (web)
    • No error with auth:web:login (web)

I will get a ticket created to look into this. In the meantime (if you are able) you could use an alternative auth method to your scratch org.

iowillhoit avatar Aug 26 '22 19:08 iowillhoit

This issue has been linked to a new work item: W-11659812

git2gus[bot] avatar Aug 26 '22 19:08 git2gus[bot]

Hi @iowillhoit, do you have any news about this issue? I'm afraid I can't see the details for the work item you linked and it's still preventing us from finishing our CI/CD. Thanks!

javierCTL avatar Oct 13 '22 16:10 javierCTL

@javierCTL - this issue is in the queue to be worked on.

shetzel avatar Oct 18 '22 20:10 shetzel

https://github.com/salesforcecli/plugin-user/pull/473

WillieRuemmele avatar Jun 22 '23 16:06 WillieRuemmele