force:auth:jwt:grant / force:mdapi:deploy failing in 7.88.4 / 51.0.4 - FILE HAS NO CONTENT
See original GitHub issueSummary
Since 7.88.4 / 51.0.4 running force:mdapi:deploy after force:auth:jwt:grant is failing with the following error message:
Successfully authorized USERNAME with org ID ORGID
ERROR running force:mdapi:deploy: Parse error in file /root/.sfdx/USERNAME.json on line 1
FILE HAS NO CONTENT
A subsequent deployment using the same alias works so my assumption is that maybe the writing of the auth info to the file hasn’t completed by the time the deploy command runs? These commands are run one after another in our build tools.
I have tests that check our build scripts before publishing a docker container with new SFDX versions - the build scripts haven’t changed, the tests haven’t changed and the tests reliably fail at the same point so something must have changed around the auth commands or deploy commands (the auth commands seem more likely based on the error).
Steps To Reproduce:
Run force:mdapi:deploy immediately after a successful jwt authentication using force:auth:jwt:grant.
Expected result
Deploy command should initiate a deployment.
Actual result
Error, as above.
Additional information
SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
@oclif/plugin-autocomplete 0.3.0 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.2.2 (core) @oclif/plugin-not-found 1.2.4 (core) @oclif/plugin-plugins 1.9.5 (core) @oclif/plugin-update 1.4.0-2 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.6.0 (core) alias 1.1.5 (core) auth 1.4.8 (core) config 1.2.4 (core) generator 1.1.5 (core) salesforcedx 51.0.4 (core) ├─ limits 1.0.4 (core) ├─ user 1.1.2 (core) ├─ schema 1.0.4 (core) ├─ custom-metadata 1.0.11 (core) ├─ apex 0.1.4 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ templates 51.2.0 (core) └─ salesforce-alm 51.0.2 (core) sfdx-cli 7.88.4 (core) sfdx-destruction 1.0.0-beta.3 telemetry 1.1.1 (core)
OS and version:
Issue found in our docker container - Alpine Linux (see makepositive/sfdx-ant:7.88.4-2.5 for the exact container).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:14 (1 by maintainers)
I too noticed the issue frequently and randomly on docker container - Alpine Linux. Happening with the upgrade of sfdx-cli to latest, latest-rc or even the downgraded 7.83.0
I ran
sfdx force:org:list
betweensfdx force:auth:jwt:grant
andsfdx force:org:create
and it worked for me.Im also running it in my build steps of the CI