forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

`sf org resume sandbox` command returns error when the target org (user) language is not in English #2428

Open ninoish opened 1 year ago

ninoish commented 1 year ago

Summary

sf org resume sandbox command always returns error if the target sandbox language is in Japanese (in non-English languages) regardless of the sandbox status.

Steps To Reproduce

Expected result

Check the status of a sandbox creation, and log in to it if it's ready without error.

Actual result

Error (1): The sandbox test202308 cannot resume with status of 完了.

System Information

sf version --verbose --json

{
  "cliVersion": "@salesforce/cli/2.5.8",
  "architecture": "darwin-x64",
  "nodeVersion": "node-v18.16.0",
  "osVersion": "Darwin 22.6.0",
  "shell": "zsh",
  "rootPath": "/Users/ninoish/.volta/tools/image/packages/@salesforce/cli/lib/node_modules/@salesforce/cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.6 (core)",
    "@oclif/plugin-commands 2.2.22 (core)",
    "@oclif/plugin-help 5.2.17 (core)",
    "@oclif/plugin-not-found 2.3.37 (core)",
    "@oclif/plugin-plugins 3.2.6 (core)",
    "@oclif/plugin-search 0.0.22 (core)",
    "@oclif/plugin-update 3.1.32 (core)",
    "@oclif/plugin-version 1.3.8 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.48 (core)",
    "@oclif/plugin-which 2.2.30 (core)",
    "@salesforce/cli 2.5.8 (core)",
    "apex 2.3.10 (core)",
    "auth 2.8.12 (core)",
    "data 2.5.6 (core)",
    "deploy-retrieve 1.17.5 (core)",
    "functions 1.21.10 (user)",
    "info 2.6.39 (core)",
    "limits 2.3.30 (core)",
    "login 1.2.26 (core)",
    "org 2.10.0 (core)",
    "schema 2.3.23 (core)",
    "settings 1.4.25 (core)",
    "sobject 0.2.4 (core)",
    "source 2.10.31 (core)",
    "telemetry 2.3.0 (core)",
    "templates 55.5.10 (core)",
    "trust 2.6.1 (core)",
    "user 2.3.28 (core)"
  ]
}
github-actions[bot] commented 1 year ago

Hello @ninoish :wave: It looks like you didn't include the full Salesforce CLI version information in your issue. Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

Thank you!

github-actions[bot] commented 1 year ago

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] commented 1 year ago

Hello @ninoish :wave: None of the versions of sf you shared match the latest release.

Shared: 2.1.7 Latest: 2.5.8

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue. You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

github-actions[bot] commented 1 year ago

Hello @ninoish :wave: None of the versions of sf you shared match the latest release.

Shared: 2.5.7 Latest: 2.5.8

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue. You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

AllanOricil commented 1 year ago

Call saitama

AllanOricil commented 1 year ago

Started the creation with english

image

then, while the sandbox was beeing created, I changed my user language to Japonese (easter egg)

image

and finally tried to get its status again, which gave me the error mentioned above

image

then I changed my language to english once again and the issue was gone

image

finally I changed it to spanish and verified the same issue happens, proving it is not a problem with japonese, but with all other languages different than english.

image image

This is a problem with the sandbox creation api and not with the cli. The API return responses with i18n (daf) and the CLI expects english only.

I would not fix or improve this because:

1 - it does not break the sandbox creation.

image Screenshot 2023-08-26 at 16 59 40

2 - it would be necessary to invest some effort to enable i18n

AllanOricil commented 1 year ago

@ninoish (saitama) just use english and stop training because you are already too OP

ninoish commented 1 year ago

Thank you @AllanOricil for kind repro steps! I would go with switching user language before Sandbox creation in my automation process.

To fetch instance url, access token and user id

sfdx force:user:display --json -o SANDBOX_TARGET_ORG

to change use language

curl --location --request PATCH 'https://{INSTANCE_URL}/services/data/v58.0/sobjects/User/{USER_ID}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--data '{
    "LanguageLocaleKey": "en_US"
}'
sf org create sandbox -o SANDBOX_TARGET_ORG -l Developer -n test202308 --no-prompt --async

Then run

sf org resume sandbox --name test202308

Then switch the source org language back.

curl --location --request PATCH 'https://{INSTANCE_URL}/services/data/v58.0/sobjects/User/{USER_ID}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--data '{
    "LanguageLocaleKey": "ja"
}'

Of course Saitama wouldn't take such a workaround, he just smash it for sure.

AllanOricil commented 1 year ago

@ninoish u are a hero 👏 Saitama would be proud of u

git2gus[bot] commented 1 year ago

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

mshanemc commented 1 year ago

I'm calling this a bug and am going to ask the Sandbox team to have their API follow the docs and only return the enumerated values for Status which are all in English https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_sandboxprocess.htm

github-actions[bot] commented 1 year ago

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.